Package com.db4o.internal
Class DefragmentContextImpl
- java.lang.Object
-
- com.db4o.internal.DefragmentContextImpl
-
- All Implemented Interfaces:
DefragmentContext
,AspectVersionContext
,HandlerVersionContext
,MarshallingInfo
,ReadWriteBuffer
,BufferContext
,Context
,ReadBuffer
,WriteBuffer
public final class DefragmentContextImpl extends java.lang.Object implements ReadWriteBuffer, DefragmentContext
-
-
Constructor Summary
Constructors Constructor Description DefragmentContextImpl(ByteArrayBuffer source, DefragmentServices services)
DefragmentContextImpl(ByteArrayBuffer source, DefragmentServices services, ObjectHeader header)
DefragmentContextImpl(ByteArrayBuffer source, DefragmentContextImpl context)
DefragmentContextImpl(DefragmentContextImpl parentContext, ObjectHeader header)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Slot
allocateMappedTargetSlot(int sourceAddress, int length)
only used by old handlers: OpenTypeHandler0, StringHandler0, ArrayHandler0.Slot
allocateTargetSlot(int length)
only used by old handlers: OpenTypeHandler0, StringHandler0, ArrayHandler0.void
beginSlot()
ReadBuffer
buffer()
ClassMetadata
classMetadata()
int
consumeCurrentParentSourceID()
ObjectContainerBase
container()
void
copyAddress()
int
copyID()
int
copyID(boolean flipNegative)
int
copyIDReturnOriginalID()
int
copyIDReturnOriginalID(boolean flipNegative)
int
copySlotlessID()
int
copySlotToNewMapped(int sourceAddress, int length)
int
copyUnindexedID()
void
currentParentSourceID(int id)
int
declaredAspectCount()
void
declaredAspectCount(int count)
void
defragment(TypeHandler4 handler)
int
handlerVersion()
void
incrementIntSize()
void
incrementOffset(int numBytes)
void
incrementStringOffset(LatinStringIO sio)
boolean
isLegacyHandlerVersion()
boolean
isNull(int fieldIndex)
int
length()
int
mappedID(int origID)
IDMapping
mapping()
ObjectContainer
objectContainer()
int
offset()
returns the current offset in the bufferstatic void
processCopy(DefragmentServices context, int sourceID, SlotCopyHandler command)
static void
processCopy(DefragmentServices services, int sourceID, SlotCopyHandler command, ByteArrayBuffer sourceReader)
void
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.void
readEnd()
int
readInt()
reads an int from the buffer.long
readLong()
reads a long from the buffer.void
seek(int offset)
positions the read pointer at the specified positionDefragmentServices
services()
SlotFormat
slotFormat()
ByteArrayBuffer
sourceBuffer()
ByteArrayBuffer
sourceBufferByAddress(int sourceAddress, int length)
ByteArrayBuffer
sourceBufferById(int sourceId)
Transaction
systemTrans()
ByteArrayBuffer
targetBuffer()
void
targetWriteBytes(int address, ByteArrayBuffer buffer)
Transaction
transaction()
TypeHandler4
typeHandlerForId(int id)
void
write(LocalObjectContainer file, int address)
void
writeByte(byte value)
writes a single byte to the buffer.void
writeBytes(byte[] bytes)
writes an array of bytes to the buffervoid
writeInt(int value)
writes an int to the buffer.void
writeLong(long value)
writes a long to the bufferint
writeMappedID(int originalID)
void
writeToTarget(int address)
-
-
-
Constructor Detail
-
DefragmentContextImpl
public DefragmentContextImpl(ByteArrayBuffer source, DefragmentContextImpl context)
-
DefragmentContextImpl
public DefragmentContextImpl(ByteArrayBuffer source, DefragmentServices services)
-
DefragmentContextImpl
public DefragmentContextImpl(ByteArrayBuffer source, DefragmentServices services, ObjectHeader header)
-
DefragmentContextImpl
public DefragmentContextImpl(DefragmentContextImpl parentContext, ObjectHeader header)
-
-
Method Detail
-
offset
public int offset()
Description copied from interface:ReadBuffer
returns the current offset in the buffer- Specified by:
offset
in interfaceReadBuffer
- Returns:
- the offset
-
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
-
incrementOffset
public void incrementOffset(int numBytes)
- Specified by:
incrementOffset
in interfaceDefragmentContext
- Specified by:
incrementOffset
in interfaceReadWriteBuffer
-
incrementIntSize
public void incrementIntSize()
- Specified by:
incrementIntSize
in interfaceReadWriteBuffer
-
copySlotlessID
public int copySlotlessID()
- Specified by:
copySlotlessID
in interfaceDefragmentContext
-
copyUnindexedID
public int copyUnindexedID()
- Specified by:
copyUnindexedID
in interfaceDefragmentContext
-
copyID
public int copyID()
- Specified by:
copyID
in interfaceDefragmentContext
-
copyID
public int copyID(boolean flipNegative)
-
copyIDReturnOriginalID
public int copyIDReturnOriginalID()
- Specified by:
copyIDReturnOriginalID
in interfaceDefragmentContext
-
copyIDReturnOriginalID
public int copyIDReturnOriginalID(boolean flipNegative)
-
readBegin
public void readBegin(byte identifier)
- Specified by:
readBegin
in interfaceReadWriteBuffer
-
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 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.
-
readInt
public int readInt()
Description copied from interface:ReadBuffer
reads an int from the buffer.- Specified by:
readInt
in interfaceReadBuffer
- Returns:
- the int
-
writeInt
public void writeInt(int value)
Description copied from interface:WriteBuffer
writes an int to the buffer.- Specified by:
writeInt
in interfaceWriteBuffer
- Parameters:
value
- the int
-
write
public void write(LocalObjectContainer file, int address)
-
incrementStringOffset
public void incrementStringOffset(LatinStringIO sio)
-
sourceBuffer
public ByteArrayBuffer sourceBuffer()
- Specified by:
sourceBuffer
in interfaceDefragmentContext
-
targetBuffer
public ByteArrayBuffer targetBuffer()
- Specified by:
targetBuffer
in interfaceDefragmentContext
-
mapping
public IDMapping mapping()
-
systemTrans
public Transaction systemTrans()
-
services
public DefragmentServices services()
- Specified by:
services
in interfaceDefragmentContext
-
processCopy
public static void processCopy(DefragmentServices context, int sourceID, SlotCopyHandler command)
-
processCopy
public static void processCopy(DefragmentServices services, int sourceID, SlotCopyHandler command, ByteArrayBuffer sourceReader)
-
writeByte
public void writeByte(byte value)
Description copied from interface:WriteBuffer
writes a single byte to the buffer.- Specified by:
writeByte
in interfaceWriteBuffer
- Parameters:
value
- the byte
-
readLong
public long readLong()
Description copied from interface:ReadBuffer
reads a long from the buffer.- Specified by:
readLong
in interfaceReadBuffer
- Returns:
- the long
-
writeLong
public void writeLong(long value)
Description copied from interface:WriteBuffer
writes a long to the buffer- Specified by:
writeLong
in interfaceWriteBuffer
- Parameters:
value
- the long
-
readBitMap
public BitMap4 readBitMap(int bitCount)
- Specified by:
readBitMap
in interfaceReadBuffer
-
readEnd
public void readEnd()
- Specified by:
readEnd
in interfaceReadWriteBuffer
-
writeMappedID
public int writeMappedID(int originalID)
-
length
public int length()
- Specified by:
length
in interfaceReadWriteBuffer
-
transaction
public Transaction transaction()
- Specified by:
transaction
in interfaceContext
-
container
public ObjectContainerBase container()
- Specified by:
container
in interfaceDefragmentContext
-
typeHandlerForId
public TypeHandler4 typeHandlerForId(int id)
- Specified by:
typeHandlerForId
in interfaceDefragmentContext
-
handlerVersion
public int handlerVersion()
- Specified by:
handlerVersion
in interfaceDefragmentContext
- Specified by:
handlerVersion
in interfaceHandlerVersionContext
-
isLegacyHandlerVersion
public boolean isLegacyHandlerVersion()
- Specified by:
isLegacyHandlerVersion
in interfaceDefragmentContext
-
mappedID
public int mappedID(int origID)
- Specified by:
mappedID
in interfaceDefragmentContext
-
objectContainer
public ObjectContainer objectContainer()
- Specified by:
objectContainer
in interfaceContext
-
allocateTargetSlot
public Slot allocateTargetSlot(int length)
only used by old handlers: OpenTypeHandler0, StringHandler0, ArrayHandler0. Doesn't need to work with modern IdSystems.- Specified by:
allocateTargetSlot
in interfaceDefragmentContext
-
allocateMappedTargetSlot
public Slot allocateMappedTargetSlot(int sourceAddress, int length)
only used by old handlers: OpenTypeHandler0, StringHandler0, ArrayHandler0. Doesn't need to work with modern IdSystems.- Specified by:
allocateMappedTargetSlot
in interfaceDefragmentContext
-
copySlotToNewMapped
public int copySlotToNewMapped(int sourceAddress, int length) throws java.io.IOException
- Specified by:
copySlotToNewMapped
in interfaceDefragmentContext
- Throws:
java.io.IOException
-
targetWriteBytes
public void targetWriteBytes(int address, ByteArrayBuffer buffer)
- Specified by:
targetWriteBytes
in interfaceDefragmentContext
-
sourceBufferByAddress
public ByteArrayBuffer sourceBufferByAddress(int sourceAddress, int length) throws java.io.IOException
- Specified by:
sourceBufferByAddress
in interfaceDefragmentContext
- Throws:
java.io.IOException
-
sourceBufferById
public ByteArrayBuffer sourceBufferById(int sourceId) throws java.io.IOException
- Specified by:
sourceBufferById
in interfaceDefragmentContext
- Throws:
java.io.IOException
-
writeToTarget
public void writeToTarget(int address)
-
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
-
buffer
public ReadBuffer buffer()
- Specified by:
buffer
in interfaceBufferContext
- Specified by:
buffer
in interfaceMarshallingInfo
-
defragment
public void defragment(TypeHandler4 handler)
- Specified by:
defragment
in interfaceDefragmentContext
-
beginSlot
public void beginSlot()
- Specified by:
beginSlot
in interfaceMarshallingInfo
-
classMetadata
public ClassMetadata classMetadata()
- Specified by:
classMetadata
in interfaceMarshallingInfo
-
isNull
public boolean isNull(int fieldIndex)
- Specified by:
isNull
in interfaceMarshallingInfo
-
declaredAspectCount
public int declaredAspectCount()
- Specified by:
declaredAspectCount
in interfaceAspectVersionContext
-
declaredAspectCount
public void declaredAspectCount(int count)
- Specified by:
declaredAspectCount
in interfaceAspectVersionContext
-
slotFormat
public SlotFormat slotFormat()
- Specified by:
slotFormat
in interfaceHandlerVersionContext
-
currentParentSourceID
public void currentParentSourceID(int id)
-
consumeCurrentParentSourceID
public int consumeCurrentParentSourceID()
-
copyAddress
public void copyAddress()
-
-