|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--com.sssw.srv.mail.AgoBufferingInputStream
Provides an input stream suited to streaming MIME messages. In addition to methods to peek at bytes without removing them from the stream, this class implements a notion of boundaries that can partition the stream by MIME content boundaries. When a boundary is hit while reading, the stream appears to be at the end. This is typically used to read from an AgoByteStore.
Constructor Summary | |
AgoBufferingInputStream()
|
Method Summary | |
void |
clearBoundary()
Clears the last boundary set using the setBoundary() method. |
void |
clearMark()
Clears the last set mark position. |
int |
peek()
Peeks at the next byte in the character or byte store witout advancing the offset. |
int |
peek(int nth)
Returns the nth next byte from the current offset in the character store, byte store, or input stream without consuming it. |
void |
setBoundary(byte[] boundary)
Sets a new boundary. |
void |
setMark()
Sets a mark position. |
void |
unwindToMark()
Restores the input stream to the last mark set. |
Methods inherited from class java.io.InputStream |
available,
close,
mark,
markSupported,
read,
read,
read,
reset,
skip |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public AgoBufferingInputStream()
Method Detail |
public void setBoundary(byte[] boundary)
boundary
- specifies the boundary to set.The stream ends when the boundary is encountered in the underlying stream. This allows a stream to be used in parsing MIME messages. The boundary can be cleared using the clearBoundary() method.
bis.setBoundary(someByte);
AgoBufferingInputStream.clearBoundary()
,
AgoBufferingInputStream.clearMark()
,
AgoBufferingInputStream.setMark()
public void clearBoundary()
bis.clearBoundary();
AgoBufferingInputStream.setBoundary( byte[] boundary )
public int peek() throws IOException
The read() method can then be used to read the byte. This is shorthand for peek(); The peek() method does not move the offset, the read() method does.
int i = bis.peek();
AgoBufferingInputStream.peek( int nth )
,
InputStream.read()
public int peek(int nth) throws IOException
nth
- specifies the byte to peek at. It is zero-based, 0 is the next byte.The nth parameter is zero-based. If the value of nth is 0, the next byte is returned. If the value of nth is 1, the second byte is returned, etc. The read() method can then be used to read the byte. The peek() method does not move the offset, the read() method does.
int i = bis.peek(1);
AgoBufferingInputStream.peek()
,
InputStream.read()
public void setMark()
Once a mark is set, all read operations can be undone until the clearMark() method is called. If needed, the unwindToMark() method can be called to restore the stream to the position is was at when the setMark() method was last called.
bis.setMark();
AgoBufferingInputStream.clearMark()
,
AgoBufferingInputStream.unwindToMark()
public void clearMark()
Once a mark is set, all read operations can be undone until the clearMark() method is called. If needed, the unwindToMark() method can be called to "unwind" (restore) the stream to the position is was at when the the setMark() method was last called.
bis.clearMark();
AgoBufferingInputStream.setMark()
,
AgoBufferingInputStream.unwindToMark()
public void unwindToMark()
Once a mark is set, all read operations can be undone until the clearMark() method is called. If needed, the unwindToMark() method can be called to restore the stream to the position is was at when the setMark() method was last called.
bis.unwindToMark();
AgoBufferingInputStream.clearMark()
,
AgoBufferingInputStream.setMark()
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |