org.xerial.db.cache
Class Buffer

java.lang.Object
  extended by org.xerial.db.cache.Buffer

public class Buffer
extends Object

Buffer to read/write raw memory data

Author:
leo

Constructor Summary
Buffer(byte[] buffer)
           
Buffer(int bufferByteSize)
           
 
Method Summary
 boolean isSet(int bytePos, int bitPositionFromMSB)
           
 void load(DBFile dbFile)
           
 boolean readBoolean(int pos)
           
 byte readByte(int pos)
           
 int readInt(int pos)
          Reads an 32-bit integer (Big-endian) from the specified byte position.
 long readLong(int pos)
           
 VariableLengthInteger readVariableLengthInteger(int pos)
           
 void save(DBFile dbFile)
          Writes an utf-8 data 0xxxxxxx 110xxxxx 10xxxxxx 1110xxxx 10xxxxxx 10xxxxxx 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
 void set(int bytePos, int bitPositionFromMSB, boolean value)
           
 int size()
           
 void writeBoolean(int pos, boolean value)
           
 void writeByte(int pos, int b)
           
 void writeInt(int pos, int value)
           
 void writeLong(int pos, long value)
           
 void writeVariablenLengthInteger(int pos, VariableLengthInteger value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Buffer

public Buffer(int bufferByteSize)

Buffer

public Buffer(byte[] buffer)
Method Detail

size

public int size()

readInt

public int readInt(int pos)
Reads an 32-bit integer (Big-endian) from the specified byte position.

Parameters:
pos -
Returns:

readByte

public byte readByte(int pos)

readLong

public long readLong(int pos)

readBoolean

public boolean readBoolean(int pos)

readVariableLengthInteger

public VariableLengthInteger readVariableLengthInteger(int pos)
                                                throws DBException
Throws:
DBException

isSet

public boolean isSet(int bytePos,
                     int bitPositionFromMSB)

set

public void set(int bytePos,
                int bitPositionFromMSB,
                boolean value)

writeByte

public void writeByte(int pos,
                      int b)

writeInt

public void writeInt(int pos,
                     int value)

writeLong

public void writeLong(int pos,
                      long value)

writeBoolean

public void writeBoolean(int pos,
                         boolean value)

writeVariablenLengthInteger

public void writeVariablenLengthInteger(int pos,
                                        VariableLengthInteger value)

save

public void save(DBFile dbFile)
          throws DBException
Writes an utf-8 data 0xxxxxxx 110xxxxx 10xxxxxx 1110xxxx 10xxxxxx 10xxxxxx 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx

Parameters:
pos - position to which data is written
data - the data buffer to be read
offset - an offset from the beginning of the data buffer
Throws:
UTFDataFormatException
DBException

load

public void load(DBFile dbFile)
          throws DBException
Throws:
DBException


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.1 Japan License.