com.jniwrapper
Class AbstractBuffer

java.lang.Object
  extended by com.jniwrapper.AbstractBuffer
All Implemented Interfaces:
DataBuffer
Direct Known Subclasses:
NullBuffer

public class AbstractBuffer
extends java.lang.Object
implements DataBuffer


Constructor Summary
AbstractBuffer()
           
 
Method Summary
protected  void assertZero(int offset)
           
 byte readByte(int offset)
          Reads a byte at a given offset.
 void readByteArray(int offset, byte[] dstArray, int dstOffset, int length)
          Copies data from this source to an array.
 byte[] readByteArray(int offset, int length)
          Reads the length bytes from this source.
 long readCallbackReference(int offset)
          Reads a callback reference (pointer) at a given offset.
 int readInt(int offset)
          Reads an int (2-byte signed) value at a given offset.
 long readLong(int offset)
          Reads a long (8-byte signed) value at a given offset.
 long readPointer(int offset)
          Reads a pointer value at a given offset.
 short readShort(int offset)
          Reads a short (2-byte signed) value at a given offset.
 void resize(int newSize)
          Resizes this source so that it can hold the newSize bytes.
 void writeByte(int offset, byte val)
          Writes a single byte at a given offset.
 void writeByteArray(int offset, byte[] val)
          Copies all data from a given array to this source.
 void writeByteArray(int offset, byte[] val, int srcOffset, int length)
          Copies data from an array to this source.
 void writeCallbackReference(int offset, long val)
          Writes a callback reference (pointer) at a given offset.
 void writeInt(int offset, int val)
          Writes an int (4-byte signed) value at a given offset.
 void writeLong(int offset, long val)
          Writes a long (8-byte signed) value at a given offset.
 void writePointer(int offset, long val)
          Writes a pointer value at a given offset.
 void writeShort(int offset, short val)
          Writes a short (2-byte signed) value at a given offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBuffer

public AbstractBuffer()
Method Detail

assertZero

protected void assertZero(int offset)

writeByte

public void writeByte(int offset,
                      byte val)
Description copied from interface: DataBuffer
Writes a single byte at a given offset.

Specified by:
writeByte in interface DataBuffer

readByte

public byte readByte(int offset)
Description copied from interface: DataBuffer
Reads a byte at a given offset.

Specified by:
readByte in interface DataBuffer

writeShort

public void writeShort(int offset,
                       short val)
Description copied from interface: DataBuffer
Writes a short (2-byte signed) value at a given offset.

Specified by:
writeShort in interface DataBuffer

readShort

public short readShort(int offset)
Description copied from interface: DataBuffer
Reads a short (2-byte signed) value at a given offset.

Specified by:
readShort in interface DataBuffer

writeInt

public void writeInt(int offset,
                     int val)
Description copied from interface: DataBuffer
Writes an int (4-byte signed) value at a given offset.

Specified by:
writeInt in interface DataBuffer

readInt

public int readInt(int offset)
Description copied from interface: DataBuffer
Reads an int (2-byte signed) value at a given offset.

Specified by:
readInt in interface DataBuffer

writeLong

public void writeLong(int offset,
                      long val)
Description copied from interface: DataBuffer
Writes a long (8-byte signed) value at a given offset.

Specified by:
writeLong in interface DataBuffer

readLong

public long readLong(int offset)
Description copied from interface: DataBuffer
Reads a long (8-byte signed) value at a given offset.

Specified by:
readLong in interface DataBuffer

writePointer

public void writePointer(int offset,
                         long val)
Description copied from interface: DataBuffer
Writes a pointer value at a given offset.

Specified by:
writePointer in interface DataBuffer

readPointer

public long readPointer(int offset)
Description copied from interface: DataBuffer
Reads a pointer value at a given offset.

Specified by:
readPointer in interface DataBuffer

writeCallbackReference

public void writeCallbackReference(int offset,
                                   long val)
Description copied from interface: DataBuffer
Writes a callback reference (pointer) at a given offset.

Specified by:
writeCallbackReference in interface DataBuffer

readCallbackReference

public long readCallbackReference(int offset)
Description copied from interface: DataBuffer
Reads a callback reference (pointer) at a given offset.

Specified by:
readCallbackReference in interface DataBuffer

writeByteArray

public void writeByteArray(int offset,
                           byte[] val,
                           int srcOffset,
                           int length)
Description copied from interface: DataBuffer
Copies data from an array to this source.

Specified by:
writeByteArray in interface DataBuffer
Parameters:
offset - target offset in this DataSource
val - where to get data
srcOffset - starting offset in the val array
length - the number of bytes to copy

readByteArray

public void readByteArray(int offset,
                          byte[] dstArray,
                          int dstOffset,
                          int length)
Description copied from interface: DataBuffer
Copies data from this source to an array.

Specified by:
readByteArray in interface DataBuffer
Parameters:
offset - source offset in this DataSource
dstArray - where to put data
dstOffset - starting offset in the dstArray array
length - the number of bytes to copy

writeByteArray

public void writeByteArray(int offset,
                           byte[] val)
Description copied from interface: DataBuffer
Copies all data from a given array to this source.

Specified by:
writeByteArray in interface DataBuffer

readByteArray

public byte[] readByteArray(int offset,
                            int length)
Description copied from interface: DataBuffer
Reads the length bytes from this source.

Specified by:
readByteArray in interface DataBuffer

resize

public void resize(int newSize)
Description copied from interface: DataBuffer
Resizes this source so that it can hold the newSize bytes.

Specified by:
resize in interface DataBuffer