DataBlock.WriteResult
Modifier and Type | Field and Description |
---|---|
static int |
STREAM_HEADER_SPACE |
Constructor and Description |
---|
DataBlockImpl(long position,
DataBlockFactory dataBlockFactory,
MappedByteBuffer mappedByteBuffer) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
int |
capacity()
The capacity of the block available for storage, this is excluding the
size of the header.
|
void |
close() |
void |
flush() |
MappedByteBuffer |
getBuffer() |
DataBlockHeader |
getHeader() |
ReadWriteLock |
getLockManager() |
long |
getPosition() |
DataBlockResult<byte[]> |
loadBytes(int offset)
Load bytes from the datablock, providing an offset from the start of the block.
|
DataBlockResult<byte[]> |
loadBytes(long absolutePosition) |
DataBlockResult<Long> |
loadLong(int offset) |
DataBlockResult<Long> |
loadLong(long absolutePosition) |
DataBlock |
loadNext() |
DataBlockResult<BlockDataInputStream> |
loadStream(int offset) |
DataBlockResult<BlockDataInputStream> |
loadStream(long absolutePosition) |
void |
reset() |
int |
size()
Returns the data size of the block on the disk including the size of the
header.
|
String |
toString() |
DataBlock.WriteResult |
writeBytes(byte[] bytes) |
DataBlock.WriteResult |
writeDataStream(InputStream stream,
boolean isDelegate) |
DataBlock.WriteResult |
writeLong(long value) |
DataBlock.WriteResult |
writeStream(InputStream stream) |
public static final int STREAM_HEADER_SPACE
public DataBlockImpl(long position, DataBlockFactory dataBlockFactory, MappedByteBuffer mappedByteBuffer)
public DataBlock loadNext() throws JasDBStorageException
loadNext
in interface DataBlock
JasDBStorageException
public long getPosition()
getPosition
in interface Block
public DataBlockHeader getHeader()
public DataBlockResult<byte[]> loadBytes(int offset) throws JasDBStorageException
DataBlock
loadBytes
in interface DataBlock
offset
- The offset to start loading the data fromJasDBStorageException
- If unable to load the bytes from the blockpublic DataBlockResult<byte[]> loadBytes(long absolutePosition) throws JasDBStorageException
loadBytes
in interface DataBlock
JasDBStorageException
public DataBlockResult<BlockDataInputStream> loadStream(long absolutePosition) throws JasDBStorageException
loadStream
in interface DataBlock
JasDBStorageException
public MappedByteBuffer getBuffer()
public ReadWriteLock getLockManager()
getLockManager
in interface DataBlock
public int capacity()
DataBlock
public int size()
DataBlock
public DataBlockResult<BlockDataInputStream> loadStream(int offset) throws JasDBStorageException
loadStream
in interface DataBlock
JasDBStorageException
public DataBlockResult<Long> loadLong(int offset) throws JasDBStorageException
loadLong
in interface DataBlock
JasDBStorageException
public DataBlockResult<Long> loadLong(long absolutePosition) throws JasDBStorageException
loadLong
in interface DataBlock
JasDBStorageException
public DataBlock.WriteResult writeBytes(byte[] bytes) throws JasDBStorageException
writeBytes
in interface DataBlock
JasDBStorageException
public DataBlock.WriteResult writeStream(InputStream stream) throws JasDBStorageException
writeStream
in interface DataBlock
JasDBStorageException
public DataBlock.WriteResult writeDataStream(InputStream stream, boolean isDelegate) throws JasDBStorageException
JasDBStorageException
public DataBlock.WriteResult writeLong(long value) throws JasDBStorageException
writeLong
in interface DataBlock
JasDBStorageException
public void close() throws JasDBStorageException
close
in interface Block
JasDBStorageException
public void flush() throws JasDBStorageException
flush
in interface DataBlock
JasDBStorageException
Copyright © 2015. All rights reserved.