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 voidappend(byte[] bytes)protected booleancanWritePersistentBase()booleancheckXBytes()voidcheckXBytes(boolean flag)booleancontainsTheSame(ByteArrayBuffer other)voidcopyTo(ByteArrayBuffer to, int fromOffset, int toOffset, int length)voidensureSize(int size)booleaneof()voidincrementIntSize()voidincrementOffset(int a_by)intlength()intoffset()returns the current offset in the buffervoidread(ObjectContainerBase stream, int address, int addressOffset)non-encrypted read, used for indexesvoidreadBegin(byte identifier)BitMap4readBitMap(int bitCount)bytereadByte()reads a byte from the buffer.voidreadBytes(byte[] bytes)reads an array of bytes from the buffer.byte[]readBytes(int a_length)ByteArrayBufferreadEmbeddedObject(Transaction trans)voidreadEncrypt(ObjectContainerBase stream, int address)voidreadEnd()intreadInt()reads an int from the buffer.longreadLong()reads a long from the buffer.ByteArrayBufferreadPayloadReader(int offset, int length)intremainingByteCount()voidseek(int offset)positions the read pointer at the specified positionvoidskip(int length)java.lang.StringtoString()voidwriteBegin(byte a_identifier)voidwriteBitMap(BitMap4 nullBitMap)voidwriteByte(byte a_byte)writes a single byte to the buffer.voidwriteBytes(byte[] bytes)writes an array of bytes to the buffervoidwriteEnd()voidwriteIDOf(Transaction trans, PersistentBase persistent)voidwriteIDOf(Transaction trans, java.lang.Object obj)voidwriteInt(int a_int)writes an int to the buffer.voidwriteLong(long l)writes a long to the buffervoidwriteShortString(Transaction trans, java.lang.String a_string)
-
-
-
Method Detail
-
seek
public void seek(int offset)
Description copied from interface:ReadBufferpositions the read pointer at the specified position- Specified by:
seekin interfaceReadBuffer- Parameters:
offset- the desired position in the buffer
-
writeBytes
public void writeBytes(byte[] bytes)
Description copied from interface:WriteBufferwrites an array of bytes to the buffer- Specified by:
writeBytesin 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:
lengthin interfaceReadWriteBuffer
-
incrementOffset
public void incrementOffset(int a_by)
- Specified by:
incrementOffsetin 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:
readBeginin interfaceReadWriteBuffer
-
readBitMap
public BitMap4 readBitMap(int bitCount)
- Specified by:
readBitMapin interfaceReadBuffer
-
readByte
public byte readByte()
Description copied from interface:ReadBufferreads a byte from the buffer.- Specified by:
readBytein interfaceReadBuffer- Returns:
- the byte
-
readBytes
public byte[] readBytes(int a_length)
-
readBytes
public void readBytes(byte[] bytes)
Description copied from interface:ReadBufferreads 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:
readBytesin 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:
readEndin interfaceReadWriteBuffer
-
readInt
public final int readInt()
Description copied from interface:ReadBufferreads an int from the buffer.- Specified by:
readIntin interfaceReadBuffer- Returns:
- the int
-
readLong
public long readLong()
Description copied from interface:ReadBufferreads a long from the buffer.- Specified by:
readLongin interfaceReadBuffer- Returns:
- the long
-
readPayloadReader
public ByteArrayBuffer readPayloadReader(int offset, int length)
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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:WriteBufferwrites a single byte to the buffer.- Specified by:
writeBytein interfaceWriteBuffer- Parameters:
a_byte- the byte
-
writeEnd
public void writeEnd()
-
writeInt
public final void writeInt(int a_int)
Description copied from interface:WriteBufferwrites an int to the buffer.- Specified by:
writeIntin 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:WriteBufferwrites a long to the buffer- Specified by:
writeLongin interfaceWriteBuffer- Parameters:
l- the long
-
incrementIntSize
public void incrementIntSize()
- Specified by:
incrementIntSizein interfaceReadWriteBuffer
-
offset
public int offset()
Description copied from interface:ReadBufferreturns the current offset in the buffer- Specified by:
offsetin 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()
-
-