Package db.buffers
Class BufferFileBlock
- java.lang.Object
- 
- db.buffers.BufferFileBlock
 
- 
 public class BufferFileBlock extends java.lang.ObjectBufferFileBlockis used to hold BufferFile blocks for use during block streaming operations.Block indexes are absolute where 0 corresponds to the head block in the BufferFile. It is important to note that this number is off by 1 from DataBuffer numbering and the index values utilized by BufferFile.getIndexCount(),BufferFile.get(DataBuffer, int),BufferFile.put(DataBuffer, int), etc.. It is important for each implementation to normalize to absolute block indexes.
- 
- 
Constructor SummaryConstructors Constructor Description BufferFileBlock(byte[] bytes)BufferFileBlock constructor for use when reconstructing instance from block streamBufferFileBlock(int blockIndex, byte[] buffer)BufferFileBlock constructor
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getData()Get block data bufferintgetIndex()Get absolute block index, where 0 corresponds to the first physical block within the buffer file.intsize()Get block sizebyte[]toBytes()Get block as byte array suitable for use in block stream and reconstruction.
 
- 
- 
- 
Constructor Detail- 
BufferFileBlockpublic BufferFileBlock(int blockIndex, byte[] buffer)BufferFileBlock constructor- Parameters:
- blockIndex- block index
- buffer- block buffer (size must match block-size for associated buffer file)
 
 - 
BufferFileBlockpublic BufferFileBlock(byte[] bytes) BufferFileBlock constructor for use when reconstructing instance from block stream- Parameters:
- bytes- buffer data received from block stream. Buffer index will be determined by first 4-bytes contained within the bytes array (big-endian).
 
 
- 
 - 
Method Detail- 
sizepublic int size() Get block size- Returns:
- block size
 
 - 
getIndexpublic int getIndex() Get absolute block index, where 0 corresponds to the first physical block within the buffer file.- Returns:
- block index
 
 - 
getDatapublic byte[] getData() Get block data buffer- Returns:
- block data buffer
 
 - 
toBytespublic byte[] toBytes() Get block as byte array suitable for use in block stream and reconstruction.- Returns:
- block as byte array
 
 
- 
 
-