|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
net.noderunner.http.LimitedInputStream
public class LimitedInputStream
An InputStream wrapper which allows only a certain number of bytes to be
read. This is used in conjunction reading from HTTP requests or responses
with supplied Content-Length headers. This stream is
unsynchronized.
LimitedOutputStream| Constructor Summary | |
|---|---|
LimitedInputStream(java.io.InputStream stream,
int lengthLimit)
Constructs a limited input stream. |
|
| Method Summary | |
|---|---|
int |
available()
Calls the wrapped stream. |
void |
close()
Closes the underlying input stream. |
void |
mark(int readlimit)
Calls the wrapped stream. |
boolean |
markSupported()
Calls the wrapped stream. |
int |
read()
Reads and returns a single byte from this input stream, or -1 if end of file or the read limit has been encountered. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the input stream into
an array of bytes, possibly less if the read limit is reached. |
void |
reset()
Calls the wrapped stream. |
java.lang.String |
toString()
Returns a debug string. |
| Methods inherited from class java.io.InputStream |
|---|
read, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public LimitedInputStream(java.io.InputStream stream,
int lengthLimit)
stream - Must be non-null.lengthLimit - limit of bytes of input.| Method Detail |
|---|
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.InputStreamjava.io.IOException
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
len bytes of data from the input stream into
an array of bytes, possibly less if the read limit is reached.
read in class java.io.InputStreamjava.io.IOException
public int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic boolean markSupported()
markSupported in class java.io.InputStream
public void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOExceptionpublic void mark(int readlimit)
mark in class java.io.InputStream
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||