ostore.util
Class QSClone.QSCloneBuffer

java.lang.Object
  |
  +--ostore.util.QSClone.QSCloneBuffer
All Implemented Interfaces:
Cloneable, InputBuffer, OutputBuffer
Enclosing class:
QSClone

public static class QSClone.QSCloneBuffer
extends Object
implements InputBuffer, OutputBuffer

This class is private for a reason; using it outside of QSClone will result in your being sacked. :)


Constructor Summary
QSClone.QSCloneBuffer()
           
 
Method Summary
 void add(BigInteger value)
           
 void add(boolean b)
           
 void add(byte input)
          Adds the specified byte to the digest.
 void add(byte[] value)
          Adds the specified byte array to the digest.
 void add(byte[] value, int offset, int length)
          Adds length bytes of the specified array to the digest, starting at offset.
 void add(double x)
           
 void add(InputBuffer buffer)
          Adds the remaining bytes in the given input buffer to this output buffer.
 void add(int i)
           
 void add(long i)
           
 void add(QuickSerializable value)
          Adds the specified object to the digest.
 void add(short i)
           
 void add(String s)
           
 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.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QSClone.QSCloneBuffer

public QSClone.QSCloneBuffer()
Method Detail

clone

public Object clone()
             throws CloneNotSupportedException
Description copied from interface: InputBuffer
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.

Specified by:
clone in interface InputBuffer
Overrides:
clone in class Object
CloneNotSupportedException

nextByte

public byte nextByte()
Description copied from interface: InputBuffer
Read the next byte out of the buffer.

Specified by:
nextByte in interface InputBuffer

nextBytes

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

Specified by:
nextBytes in interface InputBuffer
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)
Description copied from interface: InputBuffer
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.

Specified by:
nextBytes in interface InputBuffer
Parameters:
output - the output buffer into which the bytes are written

nextShort

public short nextShort()
Description copied from interface: InputBuffer
Read the next short out of the buffer.

Specified by:
nextShort in interface InputBuffer

nextInt

public int nextInt()
Description copied from interface: InputBuffer
Read the next integer out of the buffer.

Specified by:
nextInt in interface InputBuffer

nextLong

public long nextLong()
Description copied from interface: InputBuffer
Read the next long out of the buffer.

Specified by:
nextLong in interface InputBuffer

nextDouble

public double nextDouble()
Description copied from interface: InputBuffer
Read the next long out of the buffer.

Specified by:
nextDouble in interface InputBuffer

nextBoolean

public boolean nextBoolean()
Description copied from interface: InputBuffer
Read the next boolean out of the buffer.

Specified by:
nextBoolean in interface InputBuffer

nextString

public String nextString()
Description copied from interface: InputBuffer
Read the next String out of the buffer.

Specified by:
nextString in interface InputBuffer

nextBigInteger

public BigInteger nextBigInteger()
                          throws QSException
Description copied from interface: InputBuffer
Read the next BigInteger out of the buffer.

Specified by:
nextBigInteger in interface InputBuffer
QSException

nextObject

public QuickSerializable nextObject()
                             throws QSException
Description copied from interface: InputBuffer
Read the next object out of the buffer.

Specified by:
nextObject in interface InputBuffer
QSException

subBuffer

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

Specified by:
subBuffer in interface InputBuffer

add

public void add(byte input)
Description copied from interface: OutputBuffer
Adds the specified byte to the digest.

Specified by:
add in interface OutputBuffer

add

public void add(byte[] value)
Description copied from interface: OutputBuffer
Adds the specified byte array to the digest.

Specified by:
add in interface OutputBuffer

add

public void add(byte[] value,
                int offset,
                int length)
Description copied from interface: OutputBuffer
Adds length bytes of the specified array to the digest, starting at offset.

Specified by:
add in interface OutputBuffer

add

public void add(QuickSerializable value)
Description copied from interface: OutputBuffer
Adds the specified object to the digest. This method invokes the QuickSerializable.serialize method on value; be careful to avoid infinite loops.

Specified by:
add in interface OutputBuffer

add

public void add(InputBuffer buffer)
Description copied from interface: OutputBuffer
Adds the remaining bytes in the given input buffer to this output buffer.

Specified by:
add in interface OutputBuffer

add

public void add(boolean b)
Specified by:
add in interface OutputBuffer

add

public void add(short i)
Specified by:
add in interface OutputBuffer

add

public void add(int i)
Specified by:
add in interface OutputBuffer

add

public void add(long i)
Specified by:
add in interface OutputBuffer

add

public void add(double x)
Specified by:
add in interface OutputBuffer

add

public void add(String s)
Specified by:
add in interface OutputBuffer

add

public void add(BigInteger value)
Specified by:
add in interface OutputBuffer

toString

public String toString()
Overrides:
toString in class Object