|
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.Reader | +--com.sssw.srv.mail.AgoBufferingReader
A subclass of java.io.Reader, this class provides methods to deal with MIME text parts. In addition to methods to peek at bytes without consuming them, it implements a notion of boundaries that can partition the stream by MIME content boundaries. When a boundary is hit while reading, the reader appears to be at the end. Typically this is used to read text from an AgoCharStore.
Fields inherited from class java.io.Reader |
lock |
Constructor Summary | |
AgoBufferingReader()
|
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(String boundary)
Sets a boundary to be used bythis part. |
void |
setMark()
Sets a mark position. |
void |
unwindToMark()
Restores the input stream to the last mark set. |
Methods inherited from class java.io.Reader |
close,
mark,
markSupported,
read,
read,
read,
ready,
reset,
skip |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public AgoBufferingReader()
Method Detail |
public void setBoundary(String boundary)
boundary
- specifies the boundary to set.
The reader ends when the boundary is encountered in the underlying Reader.
This allows a Reader to be used in parsing MIME messages. The boundary
can be cleared using the clearBoundary()
method.
reader.setBoundary(boundaryString);
AgoBufferingReader.clearBoundary()
,
AgoBufferingReader.clearMark()
,
AgoBufferingReader.setMark()
public void clearBoundary()
setBoundary()
method.reader.clearBoundary();
AgoBufferingReader.setBoundary( String boundary )
public int peek() throws IOException
Use the read()
method to read the byte.
This is shorthand for peek()
. The peek()
method
does not move the offset, while the read()
method does.
int i = reader.peek();
AgoBufferingReader.peek( int nth )
,
Reader.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 = reader.peek(1);
Reader.read()
,
AgoBufferingReader.peek()
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 used to restore the stream to the position is was at when the setMark()
method was last called.
reader.setMark();
AgoBufferingReader.clearMark()
,
AgoBufferingReader.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.
reader.clearMark();
AgoBufferingReader.setMark()
,
AgoBufferingReader.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 used to restore the stream to the position is was at when the setMark()
method was last called.
reader.unwindToMark();
AgoBufferingReader.clearMark()
,
AgoBufferingReader.setMark()
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |