|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
org.apache.struts.upload Class MultipartBoundaryInputStream
java.lang.Object | +--java.io.InputStream | +--org.apache.struts.upload.MultipartBoundaryInputStream
Deprecated. Use the Commons FileUpload based multipart handler instead. This class will be removed after Struts 1.2.
- public class MultipartBoundaryInputStream
- extends java.io.InputStream
This class encapsulates parsing functionality for RFC1867, multipart/form-data. See MultipartBoundaryInputStreamTest and MultipartIterator for usage examples.
Field Summary | |
protected java.lang.String |
boundary
Deprecated. The boundary. |
private byte[] |
boundaryBytes
Deprecated. |
protected boolean |
boundaryEncountered
Deprecated. Whether or not the boundary has been encountered. |
protected long |
bytesRead
Deprecated. The total number of bytes read so far. |
private static byte |
CARRIAGE_RETURN
Deprecated. |
private static java.lang.String |
CONTENT_TYPE_APPLICATION_OCTET_STREAM
Deprecated. |
private static java.lang.String |
CONTENT_TYPE_TEXT_PLAIN
Deprecated. |
private static byte[] |
CRLF
Deprecated. |
private static java.lang.String |
DEFAULT_CONTENT_DISPOSITION
Deprecated. |
private static int |
DEFAULT_LINE_SIZE
Deprecated. |
private static java.lang.String |
DOUBLE_DASH_STRING
Deprecated. |
protected java.lang.String |
elementCharset
Deprecated. The character encoding of the element, specified in the element's Content-Type header. |
protected java.lang.String |
elementContentDisposition
Deprecated. The Content-Disposition for the current form element being read. |
protected java.lang.String |
elementContentType
Deprecated. The Content-Type of the current form element being read. |
protected java.lang.String |
elementFileName
Deprecated. The filename of the current form element being read, null if the current form element is
text data. |
protected java.lang.String |
elementName
Deprecated. The name of the current form element being read. |
protected boolean |
endOfStream
Deprecated. Whether or not the end of the stream has been read. |
private byte[] |
finalBoundaryBytes
Deprecated. |
protected boolean |
finalBoundaryEncountered
Deprecated. Whether or not the final boundary has been encountered. |
protected java.io.InputStream |
inputStream
Deprecated. The InputStream to read from. |
private byte[] |
line
Deprecated. |
private boolean |
lineHasCarriage
Deprecated. |
private boolean |
lineHasNewline
Deprecated. |
private int |
lineIndex
Deprecated. |
private int |
lineLength
Deprecated. |
private int |
lineSize
Deprecated. |
protected long |
maxLength
Deprecated. The maximum length in bytes to read from the stream at a time, or -1 for unlimited length. |
protected boolean |
maxLengthMet
Deprecated. Whether or not the maximum length has been met. |
private static java.lang.String |
MESSAGE_INVALID_START
Deprecated. |
private static byte |
NEWLINE_BYTE
Deprecated. |
private static java.lang.String |
PARAMETER_CHARSET
Deprecated. |
private static java.lang.String |
PARAMETER_FILENAME
Deprecated. |
private static java.lang.String |
PARAMETER_NAME
Deprecated. |
private static char |
TOKEN_COLON
Deprecated. |
private static java.lang.String |
TOKEN_EQUALS
Deprecated. |
private static char |
TOKEN_QUOTE
Deprecated. |
private static char |
TOKEN_SEMI_COLON
Deprecated. |
private static char |
TOKEN_SPACE
Deprecated. |
Fields inherited from class java.io.InputStream |
SKIP_BUFFER_SIZE, skipBuffer |
Constructor Summary | |
MultipartBoundaryInputStream()
Deprecated. |
Method Summary | |
private int |
availableInLine()
Deprecated. |
private void |
byteRead()
Deprecated. |
private java.lang.String |
checkAndFixFilename(java.lang.String filename)
Deprecated. |
private void |
checkForBoundary()
Deprecated. |
private boolean |
equals(byte[] comp,
int offset,
int length,
byte[] source)
Deprecated. Checks bytes for equality. |
private void |
fillLine()
Deprecated. |
private void |
fillLineBuffer()
Deprecated. |
long |
getBytesRead()
Deprecated. |
java.lang.String |
getElementCharset()
Deprecated. Gets the character encoding of the current element. |
java.lang.String |
getElementContentDisposition()
Deprecated. Gets the value for the "Content-Dispositio" header for the current multipart element. |
java.lang.String |
getElementContentType()
Deprecated. Gets the "Content-Type" of the current element. |
java.lang.String |
getElementFileName()
Deprecated. Gets the filename of the current element, which will be null if the current element isn't a file. |
java.lang.String |
getElementName()
Deprecated. Gets the name of the current element. |
long |
getMaxLength()
Deprecated. |
boolean |
isBoundaryEncountered()
Deprecated. Returns whether or not the boundary has been encountered while reading data. |
boolean |
isElementFile()
Deprecated. Gets whether or not the current form element being read is a file. |
boolean |
isEndOfStream()
Deprecated. Whether or not an EOF has been read on the stream. |
boolean |
isFinalBoundaryEncountered()
Deprecated. Returns whether or not the final boundary has been encountered. |
boolean |
isMaxLengthMet()
Deprecated. Whether or not the maximum length has been met. |
void |
mark(int i)
Deprecated. Marks the underlying stream. |
private java.lang.String |
parseForParameter(java.lang.String parameter,
java.lang.String parseString)
Deprecated. |
private java.lang.String |
parseHeaderValue(java.lang.String headerLine)
Deprecated. |
int |
read()
Deprecated. Reads from the stream. |
int |
read(byte[] buffer)
Deprecated. |
int |
read(byte[] buffer,
int offset,
int length)
Deprecated. |
private void |
readContentDisposition()
Deprecated. |
private boolean |
readContentType()
Deprecated. |
private void |
readElementHeaders()
Deprecated. |
private void |
readFirstElement()
Deprecated. |
private int |
readFromLine()
Deprecated. |
private java.lang.String |
readLine()
Deprecated. |
void |
reset()
Deprecated. Resets the underlying input stream. |
private void |
resetCrlf()
Deprecated. |
void |
resetForNextBoundary()
Deprecated. Resets this stream for use with the next element, to be used after a boundary is encountered. |
private void |
resetLine()
Deprecated. |
private void |
resetStream()
Deprecated. |
void |
setBoundary(java.lang.String boundary)
Deprecated. Sets the boundary that terminates the data for the stream, after adding the prefix "--" |
void |
setInputStream(java.io.InputStream stream)
Deprecated. Sets the input stream used to read multipart data. |
void |
setLineSize(int size)
Deprecated. |
void |
setMaxLength(long maxLength)
Deprecated. Set the maximum length in bytes to read, or -1 for an unlimited length. |
private void |
skipCurrentLineIfBlank()
Deprecated. |
Methods inherited from class java.io.InputStream |
available, close, markSupported, skip |
Methods inherited from class java.lang.Object |
|
Field Detail |
NEWLINE_BYTE
private static final byte NEWLINE_BYTE
- Deprecated.
CARRIAGE_RETURN
private static final byte CARRIAGE_RETURN
- Deprecated.
CRLF
private static final byte[] CRLF
- Deprecated.
DOUBLE_DASH_STRING
private static final java.lang.String DOUBLE_DASH_STRING
- Deprecated.
DEFAULT_LINE_SIZE
private static final int DEFAULT_LINE_SIZE
- Deprecated.
TOKEN_EQUALS
private static final java.lang.String TOKEN_EQUALS
- Deprecated.
TOKEN_QUOTE
private static final char TOKEN_QUOTE
- Deprecated.
TOKEN_COLON
private static final char TOKEN_COLON
- Deprecated.
TOKEN_SEMI_COLON
private static final char TOKEN_SEMI_COLON
- Deprecated.
TOKEN_SPACE
private static final char TOKEN_SPACE
- Deprecated.
DEFAULT_CONTENT_DISPOSITION
private static final java.lang.String DEFAULT_CONTENT_DISPOSITION
- Deprecated.
PARAMETER_NAME
private static final java.lang.String PARAMETER_NAME
- Deprecated.
PARAMETER_FILENAME
private static final java.lang.String PARAMETER_FILENAME
- Deprecated.
PARAMETER_CHARSET
private static final java.lang.String PARAMETER_CHARSET
- Deprecated.
CONTENT_TYPE_TEXT_PLAIN
private static final java.lang.String CONTENT_TYPE_TEXT_PLAIN
- Deprecated.
CONTENT_TYPE_APPLICATION_OCTET_STREAM
private static final java.lang.String CONTENT_TYPE_APPLICATION_OCTET_STREAM
- Deprecated.
MESSAGE_INVALID_START
private static final java.lang.String MESSAGE_INVALID_START
- Deprecated.
inputStream
protected java.io.InputStream inputStream
- Deprecated.
- The InputStream to read from.
boundary
protected java.lang.String boundary
- Deprecated.
- The boundary.
boundaryEncountered
protected boolean boundaryEncountered
- Deprecated.
- Whether or not the boundary has been encountered.
finalBoundaryEncountered
protected boolean finalBoundaryEncountered
- Deprecated.
- Whether or not the final boundary has been encountered.
endOfStream
protected boolean endOfStream
- Deprecated.
- Whether or not the end of the stream has been read.
elementContentDisposition
protected java.lang.String elementContentDisposition
- Deprecated.
- The Content-Disposition for the current form element being read.
elementName
protected java.lang.String elementName
- Deprecated.
- The name of the current form element being read.
elementContentType
protected java.lang.String elementContentType
- Deprecated.
- The Content-Type of the current form element being read.
elementFileName
protected java.lang.String elementFileName
- Deprecated.
- The filename of the current form element being read,
null
if the current form element is text data.
elementCharset
protected java.lang.String elementCharset
- Deprecated.
- The character encoding of the element, specified in the element's Content-Type header.
maxLength
protected long maxLength
- Deprecated.
- The maximum length in bytes to read from the stream at a time, or -1 for unlimited length.
maxLengthMet
protected boolean maxLengthMet
- Deprecated.
- Whether or not the maximum length has been met.
bytesRead
protected long bytesRead
- Deprecated.
- The total number of bytes read so far.
boundaryBytes
private byte[] boundaryBytes
- Deprecated.
finalBoundaryBytes
private byte[] finalBoundaryBytes
- Deprecated.
line
private byte[] line
- Deprecated.
lineSize
private int lineSize
- Deprecated.
lineLength
private int lineLength
- Deprecated.
lineHasNewline
private boolean lineHasNewline
- Deprecated.
lineHasCarriage
private boolean lineHasCarriage
- Deprecated.
lineIndex
private int lineIndex
- Deprecated.
Constructor Detail |
MultipartBoundaryInputStream
public MultipartBoundaryInputStream()
- Deprecated.
Method Detail |
setBoundary
public void setBoundary(java.lang.String boundary)
- Deprecated.
- Sets the boundary that terminates the data for the stream, after adding the prefix "--"
resetForNextBoundary
public void resetForNextBoundary() throws java.io.IOException
- Deprecated.
- Resets this stream for use with the next element, to be used after a boundary is encountered.
setInputStream
public void setInputStream(java.io.InputStream stream) throws java.io.IOException
- Deprecated.
- Sets the input stream used to read multipart data. For efficiency purposes, make sure that the stream you set on this class is buffered. The way this class reads lines is that it continually calls the read() method until it reaches a newline character. That would be terrible if you were to set a socket's input stream here, but not as bad on a buffered stream.
read
public int read() throws java.io.IOException
- Deprecated.
- Reads from the stream. Returns -1 if it's the end of the stream or if a boundary is encountered.
- Overrides:
read
in classjava.io.InputStream
read
public int read(byte[] buffer) throws java.io.IOException
- Deprecated.
- Overrides:
read
in classjava.io.InputStream
read
public int read(byte[] buffer, int offset, int length) throws java.io.IOException
- Deprecated.
- Overrides:
read
in classjava.io.InputStream
mark
public void mark(int i)
- Deprecated.
- Marks the underlying stream.
- Overrides:
mark
in classjava.io.InputStream
reset
public void reset() throws java.io.IOException
- Deprecated.
- Resets the underlying input stream.
- Overrides:
reset
in classjava.io.InputStream
setMaxLength
public void setMaxLength(long maxLength)
- Deprecated.
- Set the maximum length in bytes to read, or -1 for an unlimited length.
getMaxLength
public long getMaxLength()
- Deprecated.
isMaxLengthMet
public boolean isMaxLengthMet()
- Deprecated.
- Whether or not the maximum length has been met.
getElementContentDisposition
public java.lang.String getElementContentDisposition()
- Deprecated.
- Gets the value for the "Content-Dispositio" header for the current multipart element. Usually "form-data".
getElementName
public java.lang.String getElementName()
- Deprecated.
- Gets the name of the current element. The name corresponds to the value of the "name" attribute of the form element.
getElementCharset
public java.lang.String getElementCharset()
- Deprecated.
- Gets the character encoding of the current element. The character encoding would have been specified in the Content-Type header for this element, if it wasn't this is null.
getElementContentType
public java.lang.String getElementContentType()
- Deprecated.
- Gets the "Content-Type" of the current element. If this is a text element, the content type will probably be "text/plain", otherwise it will be the content type of the file element.
getElementFileName
public java.lang.String getElementFileName()
- Deprecated.
- Gets the filename of the current element, which will be null if the current element isn't a file.
isElementFile
public boolean isElementFile()
- Deprecated.
- Gets whether or not the current form element being read is a file.
isBoundaryEncountered
public boolean isBoundaryEncountered()
- Deprecated.
- Returns whether or not the boundary has been encountered while reading data.
isFinalBoundaryEncountered
public boolean isFinalBoundaryEncountered()
- Deprecated.
- Returns whether or not the final boundary has been encountered.
isEndOfStream
public boolean isEndOfStream()
- Deprecated.
- Whether or not an EOF has been read on the stream.
setLineSize
public void setLineSize(int size)
- Deprecated.
getBytesRead
public long getBytesRead()
- Deprecated.
readFirstElement
private final void readFirstElement() throws java.io.IOException
- Deprecated.
readElementHeaders
private final void readElementHeaders() throws java.io.IOException
- Deprecated.
readContentDisposition
private final void readContentDisposition() throws java.io.IOException
- Deprecated.
checkAndFixFilename
private final java.lang.String checkAndFixFilename(java.lang.String filename)
- Deprecated.
parseForParameter
private final java.lang.String parseForParameter(java.lang.String parameter, java.lang.String parseString)
- Deprecated.
readContentType
private final boolean readContentType() throws java.io.IOException
- Deprecated.
parseHeaderValue
private final java.lang.String parseHeaderValue(java.lang.String headerLine)
- Deprecated.
skipCurrentLineIfBlank
private final void skipCurrentLineIfBlank() throws java.io.IOException
- Deprecated.
resetCrlf
private final void resetCrlf()
- Deprecated.
resetStream
private final void resetStream()
- Deprecated.
readLine
private final java.lang.String readLine() throws java.io.IOException
- Deprecated.
readFromLine
private final int readFromLine() throws java.io.IOException
- Deprecated.
availableInLine
private final int availableInLine()
- Deprecated.
fillLine
private final void fillLine() throws java.io.IOException
- Deprecated.
resetLine
private final void resetLine()
- Deprecated.
fillLineBuffer
private final void fillLineBuffer() throws java.io.IOException
- Deprecated.
byteRead
private final void byteRead()
- Deprecated.
checkForBoundary
private final void checkForBoundary()
- Deprecated.
equals
private final boolean equals(byte[] comp, int offset, int length, byte[] source)
- Deprecated.
- Checks bytes for equality. Two byte arrays are equal if each of their elements are the same. This method checks comp[offset] with source[0] to source[length-1] with comp[offset + length - 1]
- Parameters:
comp
- The byte to compare tosource
offset
- The offset to start at incomp
length
- The length ofcomp
to compare tosource
- The reference byte array to test for equality
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright � 2000-2005 - The Apache Software Foundation