@NotStorableClass public class HeapHeader extends AbstractFileStorable
| Modifier and Type | Field and Description |
|---|---|
static int |
HEAP_HEADER_SIZE
size of the header in heap file
8 for freeRootNodeFilePosition 8 for idRootNodeFilePosition 8 for lastRecordPositionInFile 8 for endOfRecordPositionInFile 8 for usedSize 8 for freeSize 8 for next data record identifier 4 for crc32 |
fileForStorable, justCreated, logger, numberOfByteReadWrote, positionInFile, valueChangedToSave| Constructor and Description |
|---|
HeapHeader(IHeapElementManager heapElementManager)
construct header for reading in heap file or for an empty heap
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFreeSize(int newFreeAreaSize)
when an area is freed add to free and substract from used
|
void |
addUsedSize(int newUsedAreaSize)
when a new used area is addes when add to used
|
void |
clear()
initial state:no value to save since not read and not write
|
boolean |
equals(Object obj) |
long |
getEndOfRecordPositionInFile()
end of record position in file, , the position of byte after last record
|
long |
getFreeRootNodeFilePosition() |
long |
getFreeSize() |
long |
getIdRootNodeFilePosition() |
long |
getLastRecordPositionInFile() |
long |
getNextDataRecordIdentifier() |
long |
getPreviousRecordPositionInFile() |
int |
getRecordSize()
get the record size
|
long |
getUsedSize() |
protected void |
marshallImpl()
marshaling implementation for write
#crc32 is set to zero |
void |
setEndOfRecordPositionInFile(long endOfRecordPositionInFile) |
void |
setFreeRootNodeFilePosition(long freeRootNodeFilePosition) |
void |
setIdRootNodeFilePosition(long idRootNodeFilePosition) |
void |
setLastRecordPositionInFile(long lastRecordPositionInFile) |
void |
setNextDataRecordIdentifier(DataRecordIdentifier nextDataRecordIdentifier) |
void |
setNextDataRecordIdentifier(long value) |
protected int |
toMarshallSize() |
String |
toString() |
void |
unfreeSize(int areaSize)
when area is unfreed add to used and substract from free
|
protected void |
unmarshallImpl()
Unmarshalling implementation for read
#crc32 is set to zero |
protected void |
valueChangedAction() |
getPositionInFile, hashCode, isJustCreated, isValueChangedToSave, readAndCheckCrc32, readBoolean, readByte, readBytes, readBytes, readFileAppendToIoBuffer, readFileToIoBuffer, readFromFile, readInteger, readLong, setValueIsChangedValueToSave, setValueIsNotChanged, writeBoolean, writeByte, writeBytes, writeCrc32, writeInteger, writeLong, writeToFile, writeToFileGetWritedpublic static final int HEAP_HEADER_SIZE
public HeapHeader(IHeapElementManager heapElementManager)
public long getPreviousRecordPositionInFile()
throws HeapException
HeapExceptionpublic int getRecordSize()
throws HeapException
IFileStorableHeapExceptionprotected void valueChangedAction()
throws HeapException
valueChangedAction in class AbstractFileStorableHeapExceptionpublic void setFreeRootNodeFilePosition(long freeRootNodeFilePosition)
throws HeapException
HeapExceptionpublic long getFreeRootNodeFilePosition()
public void setIdRootNodeFilePosition(long idRootNodeFilePosition)
throws HeapException
HeapExceptionpublic long getIdRootNodeFilePosition()
public long getLastRecordPositionInFile()
public void setLastRecordPositionInFile(long lastRecordPositionInFile)
throws HeapException
HeapExceptionpublic long getEndOfRecordPositionInFile()
public void setEndOfRecordPositionInFile(long endOfRecordPositionInFile)
throws HeapException
HeapExceptionpublic long getNextDataRecordIdentifier()
public void setNextDataRecordIdentifier(DataRecordIdentifier nextDataRecordIdentifier) throws HeapException
HeapExceptionpublic void setNextDataRecordIdentifier(long value)
throws HeapException
HeapExceptionprotected int toMarshallSize()
toMarshallSize in class AbstractFileStorableprotected void marshallImpl()
throws HeapException
AbstractFileStorable#crc32 is set to zeromarshallImpl in class AbstractFileStorableHeapExceptionprotected void unmarshallImpl()
throws HeapException
AbstractFileStorable#crc32 is set to zerounmarshallImpl in class AbstractFileStorableHeapExceptionpublic void addUsedSize(int newUsedAreaSize)
throws HeapException
newUsedAreaSize - to add used area sizeHeapExceptionpublic void unfreeSize(int areaSize)
throws HeapException
areaSize - to add to used size and substract to free sizeHeapExceptionpublic void addFreeSize(int newFreeAreaSize)
throws HeapException
newFreeAreaSize - to substract to used size and add to free sizeHeapExceptionpublic long getFreeSize()
public long getUsedSize()
public void clear()
IFileStorableclear in interface IFileStorableclear in class AbstractFileStorablepublic String toString()
toString in class AbstractFileStorablepublic boolean equals(Object obj)
equals in class AbstractFileStorableCopyright © 2007-2012 Luc Peuvrier. All Rights Reserved.