SilverStream
Application Server 3.5

com.sssw.srv.mail
Class AgoByteStore

java.lang.Object
 |
 +--com.sssw.srv.mail.AgoByteStore
Direct Known Subclasses:
AgoByteStoreDyna, AgoByteStoreFile

public abstract class AgoByteStore
extends Object

An abstract base class for a set of classes that store a sequence of bytes. These classes are usually used to store and retrieve content in MIME parts that store byte information (the subclasses of AgoMIMEPartByteStream).


Constructor Summary
AgoByteStore()
           
 
Method Summary
 void append(AgoByteStore store)
          Appends another byte to this store.
abstract  void append(InputStream stream)
          Appends an InputStream to the store.
abstract  void append(int value)
          Appends a byte to the store.
abstract  AgoBufferingInputStream getInputStream()
          Obtains an input stream for reading this byte store.
 int getOffset()
          Gets the current offset into this byte store.
 void incrementOffset()
          Increments the current offset by 1 (one) byte.
abstract  int length()
          Returns the length of data 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 byte from the current offset in the byte store, without consuming it.
abstract  int read()
          Reads a byte from the input stream or byte store and advances the offset one byte.
abstract  void reset()
          Removes all contents of this store.
 void setOffset(int offset)
          Sets the current offset into the byte store.
abstract  String toString()
          For the AgoByteStore class, converts the byte store to a String.
 void write(OutputStream outputstream, AgoEncodingIdentifier encodingidentifier)
          Writes to the specified output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgoByteStore

public AgoByteStore()
Method Detail

read

public abstract int read()
                  throws IOException
Reads a byte from the input stream or byte store and advances the offset one byte.
Example:
     int i = byteStore.read();
 
See Also:
AgoByteStore.peek(), AgoByteStore.peek( int nth )

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, the read() method does.

Example:
     int i = byteStore.peek();
 
See Also:
AgoByteStore.read(), AgoByteStore.peek( int nth )

peek

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

append

public abstract void append(int value)
                     throws IOException
Appends a byte to the store.
Parameters:
value - the byte to append.
Example:
     byteStore.append(23);
 

append

public void append(AgoByteStore store)
            throws IOException
Appends another byte to this store.
Parameters:
store - the AgoByteStore to append.
Example:
     byteStore.append(someAgoByteStore);
 

append

public abstract void append(InputStream stream)
                     throws IOException
Appends an InputStream to the store.
Parameters:
stream - the InputStream to append.
Example:
     byteStore.append(someInputStream);
 

reset

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

length

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

getOffset

public int getOffset()
Gets the current offset into this byte store.
Example:
     int i = byteStore.getOffset();
 
See Also:
AgoByteStore.setOffset( int offset ), AgoByteStore.incrementOffset(), AgoByteStore.read(), AgoByteStore.peek()

setOffset

public void setOffset(int offset)
Sets the current offset into the byte store.
Parameters:
offset - specifies the offset amount in bytes
Example:
     byteStore.setOffset(1);
 
See Also:
AgoByteStore.getOffset(), AgoByteStore.incrementOffset()

incrementOffset

public void incrementOffset()
Increments the current offset by 1 (one) byte.
Example:
     byteStore.incrementOffset();
 
See Also:
AgoByteStore.getOffset(), AgoByteStore.setOffset( int offset )

getInputStream

public abstract AgoBufferingInputStream getInputStream()
                                                throws IOException
Obtains an input stream for reading this byte store.
Example:
     AgoBufferingInputStream in = byteStore.getInputStream();
 
See Also:
AgoBufferingInputStream

write

public void write(OutputStream outputstream,
                  AgoEncodingIdentifier encodingidentifier)
           throws IOException
Writes to the specified output stream.
Parameters:
outputstream - specifies the output stream.
encodingidentifier - specifies the encoding mechanism to use. See AgoMIME for a list of supported encoding mechanisms.
Example:
     byteStore.write(someOutputStream, "base64");
 
See Also:
AgoByteStore.read(), AgoEncodingIdentifier

toString

public abstract String toString()
For the AgoByteStore class, converts the byte store to a String.
Overrides:
toString in class Object
Example:
     String str = byteStore.toString();
 

SilverStream
Application Server 3.5