public class MimeBoundaryInputStream extends LineReaderInputStream
isLastPart()
can be used to determine if a final boundary has been seen or not.| Modifier and Type | Field and Description |
|---|---|
private boolean |
atBoundary |
private byte[] |
boundary |
private int |
boundaryLen |
private BufferedLineReaderInputStream |
buffer |
private boolean |
completed |
private boolean |
eof |
private int |
initialLength
Store the first buffer length.
|
private boolean |
lastPart |
private int |
limit |
private boolean |
strict |
| Constructor and Description |
|---|
MimeBoundaryInputStream(BufferedLineReaderInputStream inbuffer,
java.lang.String boundary)
Creates a new MimeBoundaryInputStream.
|
MimeBoundaryInputStream(BufferedLineReaderInputStream inbuffer,
java.lang.String boundary,
boolean strict)
Creates a new MimeBoundaryInputStream.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
calculateBoundaryLen() |
void |
close()
Closes the underlying stream.
|
private boolean |
endOfStream() |
boolean |
eof() |
private int |
fillBuffer() |
private boolean |
hasData() |
boolean |
isEmptyStream() |
boolean |
isFullyConsumed() |
boolean |
isLastPart() |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
boolean |
readAllowed() |
int |
readLine(ByteArrayBuffer dst)
Reads one line of text into the given
ByteArrayBuffer. |
private void |
skipBoundary() |
java.lang.String |
toString() |
boolean |
unread(ByteArrayBuffer buf)
Tries to unread the last read line.
|
private void |
verifyEndOfStream() |
private final byte[] boundary
private final boolean strict
private boolean eof
private int limit
private boolean atBoundary
private int boundaryLen
private boolean lastPart
private boolean completed
private final BufferedLineReaderInputStream buffer
private int initialLength
public MimeBoundaryInputStream(BufferedLineReaderInputStream inbuffer, java.lang.String boundary, boolean strict) throws java.io.IOException
inbuffer - The underlying stream.boundary - Boundary string (not including leading hyphens).java.lang.IllegalArgumentException - when boundary is too longjava.io.IOExceptionpublic MimeBoundaryInputStream(BufferedLineReaderInputStream inbuffer, java.lang.String boundary) throws java.io.IOException
inbuffer - The underlying stream.boundary - Boundary string (not including leading hyphens).java.lang.IllegalArgumentException - when boundary is too longjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterInputStreamjava.io.IOException - on I/O errors.public boolean markSupported()
markSupported in class java.io.FilterInputStreamInputStream.markSupported()public boolean readAllowed()
throws java.io.IOException
java.io.IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionInputStream.read()public int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int readLine(ByteArrayBuffer dst) throws java.io.IOException
LineReaderInputStreamByteArrayBuffer.readLine in class LineReaderInputStreamdst - Destination-1 if the end of
the stream has been reached.MaxLineLimitException - if the line exceeds a limit on
the line length imposed by a subclass.java.io.IOException - in case of an I/O error.private void verifyEndOfStream()
throws java.io.IOException
java.io.IOExceptionprivate boolean endOfStream()
private boolean hasData()
private int fillBuffer()
throws java.io.IOException
java.io.IOExceptionpublic boolean isEmptyStream()
public boolean isFullyConsumed()
private void calculateBoundaryLen()
throws java.io.IOException
java.io.IOExceptionprivate void skipBoundary()
throws java.io.IOException
java.io.IOExceptionpublic boolean isLastPart()
public boolean eof()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean unread(ByteArrayBuffer buf)
LineReaderInputStreamunread in class LineReaderInputStream