All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.io.InputStream | +----java.io.FilterInputStream | +----com.oreilly.servlet.multipart.PartInputStream
PartInputStream
filters a ServletInputStream
,
providing access to a single MIME part contained with in which ends with
the boundary specified. It uses buffering to provide maximum performance.
Note the readLine
method of ServletInputStream
has the annoying habit of adding a \r\n to the end of the last line. Since
we want a byte-for-byte transfer, we have to cut those chars. This means
that we must always maintain at least 2 characters in our buffer to allow
us to trim when necessary.
read
method of InputStream
.
read
method of InputStream
.
public int read() throws IOException
read
method of InputStream
.
Returns -1
(end of file) when the MIME
boundary of this part is encountered.
-1
if the end of the
stream is reached.
public int read(byte b[], int off, int len) throws IOException
read
method of InputStream
.
Returns -1
(end of file) when the MIME
boundary of this part is encountered.
-1
if there is no more data because the end
of the stream has been reached.
public int available() throws IOException
InputStream
idiom
to deal with buffering gracefully, and is not same as the length of the
part arriving in this stream.
public void close() throws IOException
This method will read any unread data in the MIME part so that the next
part starts an an expected place in the parent InputStream
.
Note that if the client code forgets to call this method on error,
MultipartParser
will call it automatically if you call
readNextPart()
.
All Packages Class Hierarchy This Package Previous Next Index