|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--org.apache.struts.upload.MultipartValueStream
This class implements an inputStream that reads another stream until a multipart boundary is found. The class reports eof when boundary found. The undelying stream is not closed.
See RFC 1867 (http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1867.txt) for details about the protocol.
Field Summary | |
private byte[] |
boundaryBytes
byte buffer with the boundary |
private boolean |
boundaryReached
have we reached the boundary? |
private boolean |
finalBoundaryReached
is the boundary found a final boundary? |
static java.lang.String |
HEADER_ENCODING
|
private java.io.InputStream |
in
the underlying stream |
private int |
matchedBoundaryBytes
how many curretly matched boundary bytes? |
private int |
readAheadBufferEndI
The end index for the read ahead cyclic buffer (points to the last byte) |
private int |
readAheadBufferStartI
The start index for the read ahead cyclic buffer (points to the first byte) |
private byte[] |
readAheadBytes
the read ahead buffer (cyclic) |
Fields inherited from class java.io.InputStream |
|
Constructor Summary | |
MultipartValueStream(java.io.InputStream in,
java.lang.String boundary)
Create a stream that stops reading at the boundary NOTE: the boundary parameter is without the trailing dashes "--". |
Method Summary | |
boolean |
encounteredFinalBoundary()
|
int |
read()
Read the next byte |
Methods inherited from class java.io.InputStream |
available, close, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String HEADER_ENCODING
private java.io.InputStream in
private byte[] boundaryBytes
private int matchedBoundaryBytes
private byte[] readAheadBytes
private int readAheadBufferStartI
private int readAheadBufferEndI
private boolean boundaryReached
private boolean finalBoundaryReached
Constructor Detail |
public MultipartValueStream(java.io.InputStream in, java.lang.String boundary) throws java.io.IOException
Method Detail |
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- if the ending boundary is never foundpublic boolean encounteredFinalBoundary() throws javax.servlet.ServletException
javax.servlet.ServletException
- if the boundary has not yet been reached
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |