| java.io.FilterInputStream com.oreilly.servlet.multipart.PartInputStream
PartInputStream | public class PartInputStream extends FilterInputStream (Code) | | A 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.
author: Geoff Soutter author: Jason Hunter version: 1.4, 2002/11/01, fix for "unexpected end of part" caused by version: boundary newlines split across buffers version: 1.3, 2001/05/21, fix to handle boundaries crossing 64K mark version: 1.2, 2001/02/07, added read(byte[]) implementation for safety version: 1.1, 2000/11/26, fixed available() to never return negative version: 1.0, 2000/10/27, initial revision |
Method Summary | |
public int | available() Returns the number of bytes that can be read from this input stream
without blocking. | public void | close() Closes this input stream and releases any system resources
associated with the stream. | public int | read() See the general contract of the read
method of InputStream . | public int | read(byte b) See the general contract of the read
method of InputStream .
Returns -1 (end of file) when the MIME
boundary of this part is encountered.
Parameters: b - the buffer into which the data is read. | public int | read(byte b, int off, int len) See the general contract of the read
method of InputStream .
Returns -1 (end of file) when the MIME
boundary of this part is encountered.
Parameters: b - the buffer into which the data is read. Parameters: off - the start offset of the data. Parameters: len - the maximum number of bytes read. |
PartInputStream | PartInputStream(ServletInputStream in, String boundary) throws IOException(Code) | | Creates a PartInputStream which stops at the specified
boundary from a ServletInputStream.
Parameters: in - a servlet input stream. Parameters: boundary - the MIME boundary to stop at. |
available | public int available() throws IOException(Code) | | Returns the number of bytes that can be read from this input stream
without blocking. This is a standard InputStream idiom
to deal with buffering gracefully, and is not same as the length of the
part arriving in this stream.
the number of bytes that can be read from the input streamwithout blocking. exception: IOException - if an I/O error occurs. |
close | public void close() throws IOException(Code) | | Closes this input stream and releases any system resources
associated with the stream.
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() .
exception: IOException - if an I/O error occurs. |
read | public int read() throws IOException(Code) | | See the general contract of the read
method of InputStream .
Returns -1 (end of file) when the MIME
boundary of this part is encountered.
the next byte of data, or -1 if the end of thestream is reached. exception: IOException - if an I/O error occurs. |
read | public int read(byte b) throws IOException(Code) | | See the general contract of the read
method of InputStream .
Returns -1 (end of file) when the MIME
boundary of this part is encountered.
Parameters: b - the buffer into which the data is read. the total number of bytes read into the buffer, or-1 if there is no more data because the endof the stream has been reached. exception: IOException - if an I/O error occurs. |
read | public int read(byte b, int off, int len) throws IOException(Code) | | See the general contract of the read
method of InputStream .
Returns -1 (end of file) when the MIME
boundary of this part is encountered.
Parameters: b - the buffer into which the data is read. Parameters: off - the start offset of the data. Parameters: len - the maximum number of bytes read. the total number of bytes read into the buffer, or-1 if there is no more data because the endof the stream has been reached. exception: IOException - if an I/O error occurs. |
|
|