ostore.util
Interface InputBuffer

All Superinterfaces:
Cloneable
All Known Implementing Classes:
InputBufferImpl, QSClone.QSCloneBuffer

public interface InputBuffer
extends Cloneable

Efficient input buffer interface.

Version:
$Id: InputBuffer.java,v 1.10 2004/05/13 20:19:53 hweather Exp $
Author:
Sean C. Rhea

Method Summary
 Object clone()
          Buffers must support clone such that the read pointer on a cloned buffer is independent of the original.
 BigInteger nextBigInteger()
          Read the next BigInteger out of the buffer.
 boolean nextBoolean()
          Read the next boolean out of the buffer.
 byte nextByte()
          Read the next byte out of the buffer.
 void nextBytes(byte[] output, int offset, int length)
          Read the next length bytes out the of the buffer, and place them in the array output, starting at index offset.
 void nextBytes(OutputBuffer output)
          Write all of the remaining bytes in this input buffer into the given output buffer.
 double nextDouble()
          Read the next long out of the buffer.
 int nextInt()
          Read the next integer out of the buffer.
 long nextLong()
          Read the next long out of the buffer.
 QuickSerializable nextObject()
          Read the next object out of the buffer.
 short nextShort()
          Read the next short out of the buffer.
 String nextString()
          Read the next String out of the buffer.
 InputBuffer subBuffer(int length)
          Create a new input buffer from the read point at this one, containing the next length bytes.
 

Method Detail

clone

public Object clone()
             throws CloneNotSupportedException
Buffers must support clone such that the read pointer on a cloned buffer is independent of the original. This functionality is used in Tapestry and will be used in SignedQS as well, I think. It relates to the need to deserialize a buffer twice. Whether or not we keep using it is subject to change.

CloneNotSupportedException

nextByte

public byte nextByte()
Read the next byte out of the buffer.


nextBytes

public void nextBytes(byte[] output,
                      int offset,
                      int length)
Read the next length bytes out the of the buffer, and place them in the array output, starting at index offset.

Parameters:
output - the array into which the bytes are written
offset - the index in output at which we start writing bytes
length - the number of bytes to read

nextBytes

public void nextBytes(OutputBuffer output)
Write all of the remaining bytes in this input buffer into the given output buffer. We need something like this so that (for example) the payload of an RouteMsg doesn't have to be deserialized on an intermediate node in its path. I'm not entirely happy with the idea, though, so please don't use it for now without talking to me first about what you're using it for.

Parameters:
output - the output buffer into which the bytes are written

nextShort

public short nextShort()
Read the next short out of the buffer.


nextInt

public int nextInt()
Read the next integer out of the buffer.


nextLong

public long nextLong()
Read the next long out of the buffer.


nextDouble

public double nextDouble()
Read the next long out of the buffer.


nextBoolean

public boolean nextBoolean()
Read the next boolean out of the buffer.


nextString

public String nextString()
Read the next String out of the buffer.


nextBigInteger

public BigInteger nextBigInteger()
                          throws QSException
Read the next BigInteger out of the buffer.

QSException

nextObject

public QuickSerializable nextObject()
                             throws QSException
Read the next object out of the buffer.

QSException

subBuffer

public InputBuffer subBuffer(int length)
Create a new input buffer from the read point at this one, containing the next length bytes. Subject to change in the future.