public class DocumentBlock extends Object
Constructor and Description |
---|
DocumentBlock(RandomAccessInputStream stream,
int size)
Create a single instance initialized with data.
|
DocumentBlock(RawDataBlock block,
int size)
create a document block from a raw data block
|
Modifier and Type | Method and Description |
---|---|
static DocumentBlock[] |
convert(long offset,
RandomAccessInputStream stream,
int numBytes,
int size,
int blockSize)
convert a single long array into an array of DocumentBlock
instances
|
protected void |
doWriteData(OutputStream stream,
byte[] data)
Default implementation of write for extending classes that
contain their data in a simple array of bytes.
|
int |
getBigBlockSize() |
static byte |
getFillByte() |
boolean |
partiallyRead()
Was this a partially read block?
|
static void |
read(DocumentBlock[] blocks,
byte[] buffer,
int offset,
int blockSize,
RandomAccessInputStream stream)
read data from an array of DocumentBlocks
|
int |
size()
Get the number of bytes read for this block
|
void |
writeBlocks(OutputStream stream)
Write the storage to an OutputStream
|
public DocumentBlock(RawDataBlock block, int size) throws IOException
block
- the raw data blocksize
- the block sizeIOException
public DocumentBlock(RandomAccessInputStream stream, int size) throws IOException
stream
- the InputStream delivering the data.IOException
public int size()
public int getBigBlockSize()
public boolean partiallyRead()
public static byte getFillByte()
public static DocumentBlock[] convert(long offset, RandomAccessInputStream stream, int numBytes, int size, int blockSize)
array
- the byte array to be convertedsize
- the intended size of the array (which may be smaller)public static void read(DocumentBlock[] blocks, byte[] buffer, int offset, int blockSize, RandomAccessInputStream stream)
blocks
- the blocks to read frombuffer
- the buffer to write the data intooffset
- the offset into the array of blocks to read fromprotected void doWriteData(OutputStream stream, byte[] data) throws IOException
stream
- the OutputStream to which the data should be
written.data
- the byte array of to be written.IOException
- on problems writing to the specified
stream.public void writeBlocks(OutputStream stream) throws IOException
writeBlocks
in interface BlockWritable
stream
- the OutputStream to which the stored data should
be writtenIOException
- on problems writing to the specified
streamCopyright © 2014 Open Microscopy Environment