org.xerial.db.cache
Class Buffer
java.lang.Object
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)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Buffer
public Buffer(int bufferByteSize)
Buffer
public Buffer(byte[] buffer)
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 writtendata - the data buffer to be readoffset - an offset from the beginning of the data buffer
- Throws:
UTFDataFormatException
DBException
load
public void load(DBFile dbFile)
throws DBException
- Throws:
DBException

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