org.tmatesoft.sqljet.core.internal
Interface ISqlJetMemoryBuffer

All Known Implementing Classes:
SqlJetByteArrayBuffer, SqlJetByteBuffer, SqlJetDirectByteBuffer

public interface ISqlJetMemoryBuffer

Represents SQLJet's operations with memory.


Method Summary
 void allocate(int size)
          Allocate chunk of memory.
 byte[] asArray()
           
 int compareTo(int pointer, ISqlJetMemoryBuffer buffer, int bufferPointer)
           
 void copyFrom(int dstPos, ISqlJetMemoryBuffer src, int srcPos, int count)
           
 void fill(int from, int count, byte value)
           
 void free()
          Fries chunk of memory.
 byte getByte(int pointer)
          Read byte at pointer.
 void getBytes(int pointer, byte[] bytes, int to, int count)
           
 int getByteUnsigned(int pointer)
          Read unsigned byte at pointer.
 int getInt(int pointer)
          Read int at pointer.
 long getIntUnsigned(int pointer)
          Read unsigned int at pointer.
 long getLong(int pointer)
          Read long at pointer.
 ISqlJetMemoryPointer getPointer(int pointer)
          Returns pointer in memory chunk at passed offset.
 short getShort(int pointer)
          Read short at pointer.
 int getShortUnsigned(int pointer)
          Read unsigned short at pointer.
 int getSize()
          Size of allocated memory chunk.
 boolean isAllocated()
          Returns true if memory is allocated.
 void putByte(int pointer, byte value)
          Write byte at pointer.
 void putBytes(int pointer, byte[] bytes, int from, int count)
           
 void putByteUnsigned(int pointer, int value)
          Write unsigned byte at pointer.
 void putInt(int pointer, int value)
          Write int at pointer.
 void putIntUnsigned(int pointer, long value)
          Write unsigned int at pointer.
 void putLong(int pointer, long value)
          Write long at pointer.
 void putShort(int pointer, short value)
          Write short at pointer.
 void putShortUnsigned(int pointer, int value)
          Write unsigned short at pointer.
 int readFromFile(int pointer, java.io.RandomAccessFile file, long position, int count)
          Read from file into memory chunk at pointer.
 int writeToFile(int pointer, java.io.RandomAccessFile file, long position, int count)
          Write from memory chunk at pointer to file.
 

Method Detail

allocate

void allocate(int size)
Allocate chunk of memory. If memory already has allocated then fries current chunk and allocates new.

Parameters:
size - size of chunk in bytes

free

void free()
Fries chunk of memory.


isAllocated

boolean isAllocated()
Returns true if memory is allocated.

Returns:

getPointer

ISqlJetMemoryPointer getPointer(int pointer)
Returns pointer in memory chunk at passed offset.

Parameters:
pointer -
Returns:

getSize

int getSize()
Size of allocated memory chunk.

Returns:

getByte

byte getByte(int pointer)
Read byte at pointer.

Parameters:
pointer -
Returns:

putByte

void putByte(int pointer,
             byte value)
Write byte at pointer.

Parameters:
pointer -
value -

getShort

short getShort(int pointer)
Read short at pointer.

Parameters:
pointer -
Returns:

putShort

void putShort(int pointer,
              short value)
Write short at pointer.

Parameters:
pointer -
value -

getInt

int getInt(int pointer)
Read int at pointer.

Parameters:
pointer -
Returns:

putInt

void putInt(int pointer,
            int value)
Write int at pointer.

Parameters:
pointer -
value -

getLong

long getLong(int pointer)
Read long at pointer.

Parameters:
pointer -
Returns:

putLong

void putLong(int pointer,
             long value)
Write long at pointer.

Parameters:
pointer -
value -

getByteUnsigned

int getByteUnsigned(int pointer)
Read unsigned byte at pointer.

Parameters:
pointer -
Returns:

putByteUnsigned

void putByteUnsigned(int pointer,
                     int value)
Write unsigned byte at pointer.

Parameters:
pointer -
value -

getShortUnsigned

int getShortUnsigned(int pointer)
Read unsigned short at pointer.

Parameters:
pointer -
Returns:

putShortUnsigned

void putShortUnsigned(int pointer,
                      int value)
Write unsigned short at pointer.

Parameters:
pointer -
value -

getIntUnsigned

long getIntUnsigned(int pointer)
Read unsigned int at pointer.

Parameters:
pointer -
Returns:

putIntUnsigned

void putIntUnsigned(int pointer,
                    long value)
Write unsigned int at pointer.

Parameters:
pointer -
value -

readFromFile

int readFromFile(int pointer,
                 java.io.RandomAccessFile file,
                 long position,
                 int count)
                 throws java.io.IOException
Read from file into memory chunk at pointer. Method isn't synchronized on file.

Parameters:
pointer -
file -
position -
count -
Returns:
Throws:
java.io.IOException

writeToFile

int writeToFile(int pointer,
                java.io.RandomAccessFile file,
                long position,
                int count)
                throws java.io.IOException
Write from memory chunk at pointer to file. Method isn't synchronized on file.

Parameters:
pointer -
file -
position -
count -
Returns:
Throws:
java.io.IOException

copyFrom

void copyFrom(int dstPos,
              ISqlJetMemoryBuffer src,
              int srcPos,
              int count)
Parameters:
dstPos -
src -
srcPos -
count -

fill

void fill(int from,
          int count,
          byte value)
Parameters:
from -
count -
value -

getBytes

void getBytes(int pointer,
              byte[] bytes,
              int to,
              int count)
Parameters:
absolute -
bytes -
to -
count -

putBytes

void putBytes(int pointer,
              byte[] bytes,
              int from,
              int count)
Parameters:
absolute -
bytes -
to -
count -

asArray

byte[] asArray()
Returns:

compareTo

int compareTo(int pointer,
              ISqlJetMemoryBuffer buffer,
              int bufferPointer)
Parameters:
pointer -
buffer -
pointer2 -
Returns: