com.jniwrapper
Interface DataBuffer

All Known Subinterfaces:
MemoryBuffer
All Known Implementing Classes:
AbstractBuffer, ByteArrayBufferBE, NullBuffer, ParameterBufferImpl

public interface DataBuffer

Basic interface to any memory location where JNIWrapper types can store their data. Subclasses may implement this interface to operate with native memory, java memory (for example, arrays) or even create specialized storages for their own needs. (Cf. java.nio.Buffer).


Method Summary
 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.
 

Method Detail

writeByte

void writeByte(int offset,
               byte val)
Writes a single byte at a given offset.


readByte

byte readByte(int offset)
Reads a byte at a given offset.


writeShort

void writeShort(int offset,
                short val)
Writes a short (2-byte signed) value at a given offset.


readShort

short readShort(int offset)
Reads a short (2-byte signed) value at a given offset.


writeInt

void writeInt(int offset,
              int val)
Writes an int (4-byte signed) value at a given offset.


readInt

int readInt(int offset)
Reads an int (2-byte signed) value at a given offset.


writeLong

void writeLong(int offset,
               long val)
Writes a long (8-byte signed) value at a given offset.


readLong

long readLong(int offset)
Reads a long (8-byte signed) value at a given offset.


writePointer

void writePointer(int offset,
                  long val)
Writes a pointer value at a given offset.


readPointer

long readPointer(int offset)
Reads a pointer value at a given offset.


writeCallbackReference

void writeCallbackReference(int offset,
                            long val)
Writes a callback reference (pointer) at a given offset.


readCallbackReference

long readCallbackReference(int offset)
Reads a callback reference (pointer) at a given offset.


writeByteArray

void writeByteArray(int offset,
                    byte[] val,
                    int srcOffset,
                    int length)
Copies data from an array to this source.

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

void readByteArray(int offset,
                   byte[] dstArray,
                   int dstOffset,
                   int length)
Copies data from this source to an array.

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

void writeByteArray(int offset,
                    byte[] val)
Copies all data from a given array to this source.


readByteArray

byte[] readByteArray(int offset,
                     int length)
Reads the length bytes from this source.


resize

void resize(int newSize)
Resizes this source so that it can hold the newSize bytes.