SilverStream
Application Server 3.5

com.sssw.srv.mail
Class AgoCharStore

java.lang.Object
 |
 +--com.sssw.srv.mail.AgoCharStore
Direct Known Subclasses:
AgoCharStoreDyna

public abstract class AgoCharStore
extends Object

Abstract base class for all character stores. A character store stores a stream of characters.


Constructor Summary
AgoCharStore()
           
 
Method Summary
 void append(AgoCharStore store)
          Appends an AgoCharStore to the store.
abstract  void append(char[] buf, int offset, int length)
          appends a segment of a character buffer to the store.
abstract  void append(int value)
          Appends a character to the store.
abstract  void append(Reader reader)
          Appends a character stream to the store.
abstract  void append(String string)
          Appends a String to the store.
 int getOffset()
          Gets the current offset into this character or store.
abstract  AgoBufferingReader getReader()
          Returns an AgoBufferingReader on this character store.
 void incrementOffset()
          Increments the current offset by 1 (one) character.
abstract  int length()
          Returns the length of data (number of characters) currently in this store.
abstract  int peek()
          Peeks at the next byte in the character or byte store witout advancing the offset.
abstract  int peek(int nth)
          Returns the nth next character from the current offset in the character store, without consuming it.
abstract  int read()
          Reads a character from the store and advances the offset one character.
abstract  void reset()
          Removes all contents of this store.
 void setOffset(int offset)
          Sets the current offset into the character store.
abstract  String toString()
          For the AgoCharStore class, converts the character store to a String.
 void write(OutputStream outputstream, AgoCharSetIdentifier charsetidentifier, AgoEncodingIdentifier encodingidentifier)
          Writes this character store to the specified output stream using a specific character set and encoding identifier.
abstract  void write(Writer writer)
          Writes the character store to the specified Writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgoCharStore

public AgoCharStore()
Method Detail

read

public abstract int read()
                  throws IOException
Reads a character from the store and advances the offset one character.
Example:
     int i = charStore.read();
 
See Also:
AgoCharStore.peek()

peek

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

The read() method can then be used 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 = charStore.peek();
 
See Also:
AgoCharStore.read(), AgoCharStore.peek( int nth )

peek

public abstract int peek(int nth)
                  throws IOException
Returns the nth next character from the current offset in the character store, 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 = charStore.peek(1);
 
See Also:
AgoCharStore.read(), AgoCharStore.peek()

append

public abstract void append(int value)
                     throws IOException
Appends a character to the store.
Parameters:
value - the character to append.
Example:
     charStore.append('b');
 
See Also:
AgoCharStore.append( String string ), AgoCharStore.append( char[] buf, int offset, int length ), AgoCharStore.append( AgoCharStore store ), AgoCharStore.append( Reader reader )

append

public abstract void append(String string)
                     throws IOException
Appends a String to the store.
Parameters:
string - specifies the String to append.
Usage:

Note that append() is an overloaded method. Use this version to append a String. The other versions provide the ability to append other data or object types.

Example:
     charStore.append("Hello World!");
 
See Also:
AgoCharStore.append( int value ), AgoCharStore.append( char[] buf, int offset, int length ), AgoCharStore.append( AgoCharStore store ), AgoCharStore.append( Reader reader )

append

public abstract void append(char[] buf,
                            int offset,
                            int length)
                     throws IOException
appends a segment of a character buffer to the store.
Parameters:
buf - specifies the character buffer to read from.
offset - specifies the offset of the character buffer to start reading from.
length - specifies the number of characters to read fromthe character buffer.
Usage:

Note that append() is an overloaded method. Use this version to append a segment of a character buffer. The other versions provide the ability to append other object or data types.

Example:
     char[] buf;
     charStore.append(buf, 0, buf.length);
 
See Also:
AgoCharStore.append( int value ), AgoCharStore.append( String string ), AgoCharStore.append( AgoCharStore store ), AgoCharStore.append( Reader reader )

append

public void append(AgoCharStore store)
            throws IOException
Appends an AgoCharStore to the store.
Parameters:
store - the AgoCharStore to append.
Usage:

Note that append() is an overloaded method. Use this version to append an AgoCharStore. The other versions provide the ability to append other object or data types.

Example:
     charStore.append(someAgoCharStore);
 
See Also:
AgoCharStore.append( int value ), AgoCharStore.append( String string ), AgoCharStore.append( char[] buf, int offset, int length ), AgoCharStore.append( Reader reader )

append

public abstract void append(Reader reader)
                     throws IOException
Appends a character stream to the store.
Parameters:
reader - specifies the Reader to append.
Usage:

Note that append() is an overloaded method. Use this version to append a Reader. The other versions provide the ability to append other data or object types.

Example:
     charStore.append(someReader);
 
See Also:
AgoCharStore.append( int value ), AgoCharStore.append( String string ), AgoCharStore.append( char[] buf, int offset, int length ), AgoCharStore.append( AgoCharStore store )

reset

public abstract void reset()
Removes all contents of this store.
Example:
     charStore.reset();
 

length

public abstract int length()
                    throws IOException
Returns the length of data (number of characters) currently in this store.
Example:
     int i = charStore.length();
 

getOffset

public int getOffset()
Gets the current offset into this character or store.
Example:
     int i = charStore.getOffset();
 
See Also:
AgoCharStore.setOffset( int offset ), AgoCharStore.incrementOffset(), AgoCharStore.read(), AgoCharStore.peek()

setOffset

public void setOffset(int offset)
Sets the current offset into the character store.
Parameters:
offset - specifies the offset amount in characters
Example:
     charStore.setOffset(1);
 
See Also:
AgoCharStore.getOffset(), AgoCharStore.incrementOffset()

incrementOffset

public void incrementOffset()
Increments the current offset by 1 (one) character.
Example:
     charStore.incrementOffset();
 
See Also:
AgoCharStore.getOffset(), AgoCharStore.setOffset( int offset)

toString

public abstract String toString()
For the AgoCharStore class, converts the character store to a String.
Overrides:
toString in class Object
Example:
     String str = charStore.toString();
 

getReader

public abstract AgoBufferingReader getReader()
                                      throws IOException
Returns an AgoBufferingReader on this character store.
Example:
     AgoBufferingReader reader = charStore.getReader();
 

write

public abstract void write(Writer writer)
                    throws IOException
Writes the character store to the specified Writer.
Parameters:
writer - specifies the writer.
Example:
     charStore.write(someWriter);
 
See Also:
AgoCharStore.read(), AgoCharStore.write( OutputStream outputstream, AgoCharSetIdentifier charsetidentifier, AgoEncodingIdentifier encodingidentifier )

write

public void write(OutputStream outputstream,
                  AgoCharSetIdentifier charsetidentifier,
                  AgoEncodingIdentifier encodingidentifier)
           throws IOException
Writes this character store to the specified output stream using a specific character set and encoding identifier.
Parameters:
outputstream - specifies the output stream.
charsetidentifier - specifies the character set to use. See AgoMIME for a list of valid character set constants.
encodingidentifier - specifies the encoding mechanism to use. See AgoMIME for a list of valid encoding mechanism constants.
Example:
     charStore.write(someOutputStream, "iso-8859-1", "quoted-printable");
 
See Also:
AgoCharStore.read(), AgoCharStore.write( Writer writer ), AgoEncodingIdentifier, AgoCharSetIdentifier

SilverStream
Application Server 3.5