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 SlotallocateMappedTargetSlot(int sourceAddress, int length)only used by old handlers: OpenTypeHandler0, StringHandler0, ArrayHandler0.SlotallocateTargetSlot(int length)only used by old handlers: OpenTypeHandler0, StringHandler0, ArrayHandler0.voidbeginSlot()ReadBufferbuffer()ClassMetadataclassMetadata()intconsumeCurrentParentSourceID()ObjectContainerBasecontainer()voidcopyAddress()intcopyID()intcopyID(boolean flipNegative)intcopyIDReturnOriginalID()intcopyIDReturnOriginalID(boolean flipNegative)intcopySlotlessID()intcopySlotToNewMapped(int sourceAddress, int length)intcopyUnindexedID()voidcurrentParentSourceID(int id)intdeclaredAspectCount()voiddeclaredAspectCount(int count)voiddefragment(TypeHandler4 handler)inthandlerVersion()voidincrementIntSize()voidincrementOffset(int numBytes)voidincrementStringOffset(LatinStringIO sio)booleanisLegacyHandlerVersion()booleanisNull(int fieldIndex)intlength()intmappedID(int origID)IDMappingmapping()ObjectContainerobjectContainer()intoffset()returns the current offset in the bufferstatic voidprocessCopy(DefragmentServices context, int sourceID, SlotCopyHandler command)static voidprocessCopy(DefragmentServices services, int sourceID, SlotCopyHandler command, ByteArrayBuffer sourceReader)voidreadBegin(byte identifier)BitMap4readBitMap(int bitCount)bytereadByte()reads a byte from the buffer.voidreadBytes(byte[] bytes)reads an array of bytes from the buffer.voidreadEnd()intreadInt()reads an int from the buffer.longreadLong()reads a long from the buffer.voidseek(int offset)positions the read pointer at the specified positionDefragmentServicesservices()SlotFormatslotFormat()ByteArrayBuffersourceBuffer()ByteArrayBuffersourceBufferByAddress(int sourceAddress, int length)ByteArrayBuffersourceBufferById(int sourceId)TransactionsystemTrans()ByteArrayBuffertargetBuffer()voidtargetWriteBytes(int address, ByteArrayBuffer buffer)Transactiontransaction()TypeHandler4typeHandlerForId(int id)voidwrite(LocalObjectContainer file, int address)voidwriteByte(byte value)writes a single byte to the buffer.voidwriteBytes(byte[] bytes)writes an array of bytes to the buffervoidwriteInt(int value)writes an int to the buffer.voidwriteLong(long value)writes a long to the bufferintwriteMappedID(int originalID)voidwriteToTarget(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:ReadBufferreturns the current offset in the buffer- Specified by:
offsetin interfaceReadBuffer- Returns:
- the offset
-
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
-
incrementOffset
public void incrementOffset(int numBytes)
- Specified by:
incrementOffsetin interfaceDefragmentContext- Specified by:
incrementOffsetin interfaceReadWriteBuffer
-
incrementIntSize
public void incrementIntSize()
- Specified by:
incrementIntSizein interfaceReadWriteBuffer
-
copySlotlessID
public int copySlotlessID()
- Specified by:
copySlotlessIDin interfaceDefragmentContext
-
copyUnindexedID
public int copyUnindexedID()
- Specified by:
copyUnindexedIDin interfaceDefragmentContext
-
copyID
public int copyID()
- Specified by:
copyIDin interfaceDefragmentContext
-
copyID
public int copyID(boolean flipNegative)
-
copyIDReturnOriginalID
public int copyIDReturnOriginalID()
- Specified by:
copyIDReturnOriginalIDin interfaceDefragmentContext
-
copyIDReturnOriginalID
public int copyIDReturnOriginalID(boolean flipNegative)
-
readBegin
public void readBegin(byte identifier)
- Specified by:
readBeginin interfaceReadWriteBuffer
-
readByte
public byte readByte()
Description copied from interface:ReadBufferreads a byte from the buffer.- Specified by:
readBytein interfaceReadBuffer- Returns:
- the byte
-
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.
-
readInt
public int readInt()
Description copied from interface:ReadBufferreads an int from the buffer.- Specified by:
readIntin interfaceReadBuffer- Returns:
- the int
-
writeInt
public void writeInt(int value)
Description copied from interface:WriteBufferwrites an int to the buffer.- Specified by:
writeIntin 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:
sourceBufferin interfaceDefragmentContext
-
targetBuffer
public ByteArrayBuffer targetBuffer()
- Specified by:
targetBufferin interfaceDefragmentContext
-
mapping
public IDMapping mapping()
-
systemTrans
public Transaction systemTrans()
-
services
public DefragmentServices services()
- Specified by:
servicesin 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:WriteBufferwrites a single byte to the buffer.- Specified by:
writeBytein interfaceWriteBuffer- Parameters:
value- the byte
-
readLong
public long readLong()
Description copied from interface:ReadBufferreads a long from the buffer.- Specified by:
readLongin interfaceReadBuffer- Returns:
- the long
-
writeLong
public void writeLong(long value)
Description copied from interface:WriteBufferwrites a long to the buffer- Specified by:
writeLongin interfaceWriteBuffer- Parameters:
value- the long
-
readBitMap
public BitMap4 readBitMap(int bitCount)
- Specified by:
readBitMapin interfaceReadBuffer
-
readEnd
public void readEnd()
- Specified by:
readEndin interfaceReadWriteBuffer
-
writeMappedID
public int writeMappedID(int originalID)
-
length
public int length()
- Specified by:
lengthin interfaceReadWriteBuffer
-
transaction
public Transaction transaction()
- Specified by:
transactionin interfaceContext
-
container
public ObjectContainerBase container()
- Specified by:
containerin interfaceDefragmentContext
-
typeHandlerForId
public TypeHandler4 typeHandlerForId(int id)
- Specified by:
typeHandlerForIdin interfaceDefragmentContext
-
handlerVersion
public int handlerVersion()
- Specified by:
handlerVersionin interfaceDefragmentContext- Specified by:
handlerVersionin interfaceHandlerVersionContext
-
isLegacyHandlerVersion
public boolean isLegacyHandlerVersion()
- Specified by:
isLegacyHandlerVersionin interfaceDefragmentContext
-
mappedID
public int mappedID(int origID)
- Specified by:
mappedIDin interfaceDefragmentContext
-
objectContainer
public ObjectContainer objectContainer()
- Specified by:
objectContainerin 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:
allocateTargetSlotin 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:
allocateMappedTargetSlotin interfaceDefragmentContext
-
copySlotToNewMapped
public int copySlotToNewMapped(int sourceAddress, int length) throws java.io.IOException- Specified by:
copySlotToNewMappedin interfaceDefragmentContext- Throws:
java.io.IOException
-
targetWriteBytes
public void targetWriteBytes(int address, ByteArrayBuffer buffer)- Specified by:
targetWriteBytesin interfaceDefragmentContext
-
sourceBufferByAddress
public ByteArrayBuffer sourceBufferByAddress(int sourceAddress, int length) throws java.io.IOException
- Specified by:
sourceBufferByAddressin interfaceDefragmentContext- Throws:
java.io.IOException
-
sourceBufferById
public ByteArrayBuffer sourceBufferById(int sourceId) throws java.io.IOException
- Specified by:
sourceBufferByIdin interfaceDefragmentContext- Throws:
java.io.IOException
-
writeToTarget
public void writeToTarget(int address)
-
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
-
buffer
public ReadBuffer buffer()
- Specified by:
bufferin interfaceBufferContext- Specified by:
bufferin interfaceMarshallingInfo
-
defragment
public void defragment(TypeHandler4 handler)
- Specified by:
defragmentin interfaceDefragmentContext
-
beginSlot
public void beginSlot()
- Specified by:
beginSlotin interfaceMarshallingInfo
-
classMetadata
public ClassMetadata classMetadata()
- Specified by:
classMetadatain interfaceMarshallingInfo
-
isNull
public boolean isNull(int fieldIndex)
- Specified by:
isNullin interfaceMarshallingInfo
-
declaredAspectCount
public int declaredAspectCount()
- Specified by:
declaredAspectCountin interfaceAspectVersionContext
-
declaredAspectCount
public void declaredAspectCount(int count)
- Specified by:
declaredAspectCountin interfaceAspectVersionContext
-
slotFormat
public SlotFormat slotFormat()
- Specified by:
slotFormatin interfaceHandlerVersionContext
-
currentParentSourceID
public void currentParentSourceID(int id)
-
consumeCurrentParentSourceID
public int consumeCurrentParentSourceID()
-
copyAddress
public void copyAddress()
-
-