ostore.util
Class StreamInputBuffer

java.lang.Object
  |
  +--ostore.util.InputBufferImpl
        |
        +--ostore.util.StreamInputBuffer
All Implemented Interfaces:
Cloneable, InputBuffer

public class StreamInputBuffer
extends InputBufferImpl

For use in testing only; not efficient at all, and not completely implemented either. See ostore.mac.HMACDHHandler for an example use.

Version:
$Id: StreamInputBuffer.java,v 1.1 2002/06/30 04:20:37 srhea Exp $
Author:
Sean C. Rhea

Field Summary
protected  InputStream stream
           
 
Constructor Summary
StreamInputBuffer(InputStream stream)
           
 
Method Summary
 byte nextByte()
          Read the next byte out of the buffer.
 void nextBytes(byte[] data, 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 outb)
          Write all of the remaining bytes in this input buffer into the given output buffer.
 InputBuffer subBuffer(int length)
          Create a new input buffer from the read point at this one, containing the next length bytes.
 
Methods inherited from class ostore.util.InputBufferImpl
clone, nextBigInteger, nextBigInteger, nextBoolean, nextBoolean, nextDouble, nextDouble, nextInt, nextInt, nextLong, nextLong, nextObject, nextObject, nextShort, nextShort, nextString, nextString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stream

protected InputStream stream
Constructor Detail

StreamInputBuffer

public StreamInputBuffer(InputStream stream)
Method Detail

nextByte

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


nextBytes

public void nextBytes(byte[] data,
                      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.

Parameters:
data - 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 outb)
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.

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

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.