Package com.db4o.internal
Class ByteArrayBuffer
- java.lang.Object
-
- com.db4o.internal.ByteArrayBuffer
-
- All Implemented Interfaces:
ReadWriteBuffer
,ReadBuffer
,WriteBuffer
- Direct Known Subclasses:
StatefulBuffer
public class ByteArrayBuffer extends java.lang.Object implements ReadWriteBuffer
-
-
Constructor Summary
Constructors Constructor Description ByteArrayBuffer(byte[] buffer)
ByteArrayBuffer(int length)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(byte[] bytes)
protected boolean
canWritePersistentBase()
boolean
checkXBytes()
void
checkXBytes(boolean flag)
boolean
containsTheSame(ByteArrayBuffer other)
void
copyTo(ByteArrayBuffer to, int fromOffset, int toOffset, int length)
void
ensureSize(int size)
boolean
eof()
void
incrementIntSize()
void
incrementOffset(int a_by)
int
length()
int
offset()
returns the current offset in the buffervoid
read(ObjectContainerBase stream, int address, int addressOffset)
non-encrypted read, used for indexesvoid
readBegin(byte identifier)
BitMap4
readBitMap(int bitCount)
byte
readByte()
reads a byte from the buffer.void
readBytes(byte[] bytes)
reads an array of bytes from the buffer.byte[]
readBytes(int a_length)
ByteArrayBuffer
readEmbeddedObject(Transaction trans)
void
readEncrypt(ObjectContainerBase stream, int address)
void
readEnd()
int
readInt()
reads an int from the buffer.long
readLong()
reads a long from the buffer.ByteArrayBuffer
readPayloadReader(int offset, int length)
int
remainingByteCount()
void
seek(int offset)
positions the read pointer at the specified positionvoid
skip(int length)
java.lang.String
toString()
void
writeBegin(byte a_identifier)
void
writeBitMap(BitMap4 nullBitMap)
void
writeByte(byte a_byte)
writes a single byte to the buffer.void
writeBytes(byte[] bytes)
writes an array of bytes to the buffervoid
writeEnd()
void
writeIDOf(Transaction trans, PersistentBase persistent)
void
writeIDOf(Transaction trans, java.lang.Object obj)
void
writeInt(int a_int)
writes an int to the buffer.void
writeLong(long l)
writes a long to the buffervoid
writeShortString(Transaction trans, java.lang.String a_string)
-
-
-
Method Detail
-
seek
public void seek(int offset)
Description copied from interface:ReadBuffer
positions the read pointer at the specified position- Specified by:
seek
in interfaceReadBuffer
- Parameters:
offset
- the desired position in the buffer
-
writeBytes
public void writeBytes(byte[] bytes)
Description copied from interface:WriteBuffer
writes an array of bytes to the buffer- Specified by:
writeBytes
in interfaceWriteBuffer
- Parameters:
bytes
- the byte array
-
append
public void append(byte[] bytes)
-
containsTheSame
public final boolean containsTheSame(ByteArrayBuffer other)
-
copyTo
public void copyTo(ByteArrayBuffer to, int fromOffset, int toOffset, int length)
-
length
public int length()
- Specified by:
length
in interfaceReadWriteBuffer
-
incrementOffset
public void incrementOffset(int a_by)
- Specified by:
incrementOffset
in interfaceReadWriteBuffer
-
read
public void read(ObjectContainerBase stream, int address, int addressOffset)
non-encrypted read, used for indexes
-
readBegin
public final void readBegin(byte identifier)
- Specified by:
readBegin
in interfaceReadWriteBuffer
-
readBitMap
public BitMap4 readBitMap(int bitCount)
- Specified by:
readBitMap
in interfaceReadBuffer
-
readByte
public byte readByte()
Description copied from interface:ReadBuffer
reads a byte from the buffer.- Specified by:
readByte
in interfaceReadBuffer
- Returns:
- the byte
-
readBytes
public byte[] readBytes(int a_length)
-
readBytes
public void readBytes(byte[] bytes)
Description copied from interface:ReadBuffer
reads an array of bytes from the buffer. The length of the array that is passed as a parameter specifies the number of bytes that are to be read. The passed bytes buffer parameter is directly filled.- Specified by:
readBytes
in interfaceReadBuffer
- Parameters:
bytes
- the byte array to read the bytes into.
-
readEmbeddedObject
public final ByteArrayBuffer readEmbeddedObject(Transaction trans) throws Db4oIOException
- Throws:
Db4oIOException
-
readEncrypt
public void readEncrypt(ObjectContainerBase stream, int address) throws Db4oIOException
- Throws:
Db4oIOException
-
readEnd
public void readEnd()
- Specified by:
readEnd
in interfaceReadWriteBuffer
-
readInt
public final int readInt()
Description copied from interface:ReadBuffer
reads an int from the buffer.- Specified by:
readInt
in interfaceReadBuffer
- Returns:
- the int
-
readLong
public long readLong()
Description copied from interface:ReadBuffer
reads a long from the buffer.- Specified by:
readLong
in interfaceReadBuffer
- Returns:
- the long
-
readPayloadReader
public ByteArrayBuffer readPayloadReader(int offset, int length)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
writeBegin
public void writeBegin(byte a_identifier)
-
writeBitMap
public final void writeBitMap(BitMap4 nullBitMap)
-
writeByte
public final void writeByte(byte a_byte)
Description copied from interface:WriteBuffer
writes a single byte to the buffer.- Specified by:
writeByte
in interfaceWriteBuffer
- Parameters:
a_byte
- the byte
-
writeEnd
public void writeEnd()
-
writeInt
public final void writeInt(int a_int)
Description copied from interface:WriteBuffer
writes an int to the buffer.- Specified by:
writeInt
in interfaceWriteBuffer
- Parameters:
a_int
- the int
-
writeIDOf
public void writeIDOf(Transaction trans, java.lang.Object obj)
-
writeIDOf
public void writeIDOf(Transaction trans, PersistentBase persistent)
-
canWritePersistentBase
protected boolean canWritePersistentBase()
-
writeShortString
public void writeShortString(Transaction trans, java.lang.String a_string)
-
writeLong
public void writeLong(long l)
Description copied from interface:WriteBuffer
writes a long to the buffer- Specified by:
writeLong
in interfaceWriteBuffer
- Parameters:
l
- the long
-
incrementIntSize
public void incrementIntSize()
- Specified by:
incrementIntSize
in interfaceReadWriteBuffer
-
offset
public int offset()
Description copied from interface:ReadBuffer
returns the current offset in the buffer- Specified by:
offset
in interfaceReadBuffer
- Returns:
- the offset
-
ensureSize
public void ensureSize(int size)
-
skip
public void skip(int length)
-
checkXBytes
public void checkXBytes(boolean flag)
-
checkXBytes
public boolean checkXBytes()
-
eof
public boolean eof()
-
remainingByteCount
public int remainingByteCount()
-
-