org.apache.struts.upload
public class MultipartBoundaryInputStream extends InputStream
Deprecated: Use the Commons FileUpload based multipart handler instead. This class will be removed after Struts 1.2.
This class encapsulates parsing functionality for RFC1867, multipart/form-data. See MultipartBoundaryInputStreamTest and MultipartIterator for usage examples.Field Summary | |
---|---|
protected String | boundary
The boundary. |
byte[] | boundaryBytes |
protected boolean | boundaryEncountered
Whether or not the boundary has been encountered. |
protected long | bytesRead
The total number of bytes read so far. |
static byte | CARRIAGE_RETURN |
static String | CONTENT_TYPE_APPLICATION_OCTET_STREAM |
static String | CONTENT_TYPE_TEXT_PLAIN |
static byte[] | CRLF |
static String | DEFAULT_CONTENT_DISPOSITION |
static int | DEFAULT_LINE_SIZE |
static String | DOUBLE_DASH_STRING |
protected String | elementCharset
The character encoding of the element, specified in the element's Content-Type header. |
protected String | elementContentDisposition
The Content-Disposition for the current form element being read. |
protected String | elementContentType
The Content-Type of the current form element being read. |
protected String | elementFileName
The filename of the current form element being read, null if the current form element is
text data. |
protected String | elementName
The name of the current form element being read. |
protected boolean | endOfStream
Whether or not the end of the stream has been read. |
byte[] | finalBoundaryBytes |
protected boolean | finalBoundaryEncountered
Whether or not the final boundary has been encountered. |
protected InputStream | inputStream
The InputStream to read from. |
byte[] | line |
boolean | lineHasCarriage |
boolean | lineHasNewline |
int | lineIndex |
int | lineLength |
int | lineSize |
protected long | maxLength
The maximum length in bytes to read from the stream at a time, or -1 for unlimited length. |
protected boolean | maxLengthMet
Whether or not the maximum length has been met. |
static String | MESSAGE_INVALID_START |
static byte | NEWLINE_BYTE |
static String | PARAMETER_CHARSET |
static String | PARAMETER_FILENAME |
static String | PARAMETER_NAME |
static char | TOKEN_COLON |
static String | TOKEN_EQUALS |
static char | TOKEN_QUOTE |
static char | TOKEN_SEMI_COLON |
static char | TOKEN_SPACE |
Constructor Summary | |
---|---|
MultipartBoundaryInputStream() |
Method Summary | |
---|---|
int | availableInLine() |
void | byteRead() |
String | checkAndFixFilename(String filename) |
void | checkForBoundary() |
boolean | equals(byte[] comp, int offset, int length, byte[] source)
Checks bytes for equality. |
void | fillLine() |
void | fillLineBuffer() |
long | getBytesRead() |
String | getElementCharset()
Gets the character encoding of the current element. |
String | getElementContentDisposition()
Gets the value for the "Content-Dispositio" header for the current multipart element.
|
String | getElementContentType()
Gets the "Content-Type" of the current element. |
String | getElementFileName()
Gets the filename of the current element, which will be null if the current element
isn't a file. |
String | getElementName()
Gets the name of the current element. |
long | getMaxLength() |
boolean | isBoundaryEncountered()
Returns whether or not the boundary has been encountered while reading data. |
boolean | isElementFile()
Gets whether or not the current form element being read is a file. |
boolean | isEndOfStream()
Whether or not an EOF has been read on the stream. |
boolean | isFinalBoundaryEncountered()
Returns whether or not the final boundary has been encountered. |
boolean | isMaxLengthMet()
Whether or not the maximum length has been met. |
void | mark(int i)
Marks the underlying stream. |
String | parseForParameter(String parameter, String parseString) |
String | parseHeaderValue(String headerLine) |
int | read()
Reads from the stream. |
int | read(byte[] buffer) |
int | read(byte[] buffer, int offset, int length) |
void | readContentDisposition() |
boolean | readContentType() |
void | readElementHeaders() |
void | readFirstElement() |
int | readFromLine() |
String | readLine() |
void | reset()
Resets the underlying input stream. |
void | resetCrlf() |
void | resetForNextBoundary()
Resets this stream for use with the next element, to be used after a boundary is encountered. |
void | resetLine() |
void | resetStream() |
void | setBoundary(String boundary)
Sets the boundary that terminates the data for the stream, after adding the prefix "--" |
void | setInputStream(InputStream stream)
Sets the input stream used to read multipart data. |
void | setLineSize(int size) |
void | setMaxLength(long maxLength)
Set the maximum length in bytes to read, or -1 for an unlimited length. |
void | skipCurrentLineIfBlank() |
null
if the current form element is
text data.Parameters: comp The byte to compare to source
offset The offset to start at in comp
length The length of comp
to compare to source The reference byte array to test for equality