simple.util
Interface ByteStore

All Known Implementing Classes:
Buffer

public interface ByteStore

The ByteStore class is used to provide access to a byte buffer. This allows objects to share a byte buffer without the problems of readers and writers changing the data. This data is read only and it provides simple methods to access the bytes stored.

Author:
Niall Gallagher

Method Summary
 byte getByte(int pos)
          This is basically a simple read method for the bytes in the ByteStore.
 void getBytes(int pos, byte[] b)
          This is basically a simple read method for the bytes in the ByteStore.
 void getBytes(int pos, byte[] b, int off, int len)
          This is basically a simple read method for the bytes in the ByteStore.
 int length()
          This returns the number of bytes that this ByteStore object contains.
 

Method Detail

getByte

byte getByte(int pos)
This is basically a simple read method for the bytes in the ByteStore. This will allow a user to read from the ByteStore at the specified positions. Concurrent threads can access the ByteStore because it is a read-only object.

Parameters:
pos - the position to read from the ByteStore
Returns:
the byte at the position specified in this object

getBytes

void getBytes(int pos,
              byte[] b)
This is basically a simple read method for the bytes in the ByteStore. This will allow a user to read from the ByteStore at the specified positions. Concurrent threads can access the ByteStore because it is a read-only object.

Parameters:
pos - the position to read from the ByteStore
b - the byte buffer to fill with the bytes

getBytes

void getBytes(int pos,
              byte[] b,
              int off,
              int len)
This is basically a simple read method for the bytes in the ByteStore. This will allow a user to read from the ByteStore at the specified positions. Concurrent threads can access the ByteStore because it is a read-only object.

Parameters:
pos - the position to read from the ByteStore
b - the byte buffer to fill with the bytes
off - position in the buffer to write the bytes
len - the number of bytes to be read from

length

int length()
This returns the number of bytes that this ByteStore object contains.

Returns:
the number of bytes stored