SilverStream
Application Server 3.5

com.sssw.srv.mail
Class AgoBufferingReader

java.lang.Object
 |
 +--java.io.Reader
       |
       +--com.sssw.srv.mail.AgoBufferingReader

public class AgoBufferingReader
extends Reader

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

AgoBufferingReader

public AgoBufferingReader()
Method Detail

setBoundary

public void setBoundary(String boundary)
Sets a boundary to be used bythis part. This method is not called: a randomly generated boundary will be used when needed.
Parameters:
boundary - specifies the boundary to set.
Usage:

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.

Example:
     reader.setBoundary(boundaryString);
 
See Also:
AgoBufferingReader.clearBoundary(), AgoBufferingReader.clearMark(), AgoBufferingReader.setMark()

clearBoundary

public void clearBoundary()
Clears the last boundary set using the setBoundary() method.
Example:
     reader.clearBoundary();
 
See Also:
AgoBufferingReader.setBoundary( String boundary )

peek

public int peek()
         throws IOException
Peeks at the next byte in the character or byte store witout advancing the offset.
Usage:

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.

Example:
     int i = reader.peek();
 
See Also:
AgoBufferingReader.peek( int nth ), Reader.read()

peek

public int peek(int nth)
         throws IOException
Returns the nth next byte from the current offset in the character store, byte store, or input stream without consuming it.
Parameters:
nth - specifies the byte to peek at. It is zero-based, 0 is the next byte.
Usage:

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.

Example:
     int i = reader.peek(1);
 
See Also:
Reader.read(), AgoBufferingReader.peek()

setMark

public void setMark()
Sets a mark position.
Usage:

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.

Example:
     reader.setMark();
 
See Also:
AgoBufferingReader.clearMark(), AgoBufferingReader.unwindToMark()

clearMark

public void clearMark()
Clears the last set mark position.
Usage:

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.

Example:
     reader.clearMark();
 
See Also:
AgoBufferingReader.setMark(), AgoBufferingReader.unwindToMark()

unwindToMark

public void unwindToMark()
Restores the input stream to the last mark set.
Usage:

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.

Example:
     reader.unwindToMark();
 
See Also:
AgoBufferingReader.clearMark(), AgoBufferingReader.setMark()

SilverStream
Application Server 3.5