public class DocumentBlock
extends java.lang.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(java.io.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(java.io.OutputStream stream)
Write the storage to an OutputStream
|
public DocumentBlock(RawDataBlock block, int size) throws java.io.IOException
block
- the raw data blocksize
- the block sizejava.io.IOException
public DocumentBlock(RandomAccessInputStream stream, int size) throws java.io.IOException
stream
- the InputStream delivering the data.java.io.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(java.io.OutputStream stream, byte[] data) throws java.io.IOException
stream
- the OutputStream to which the data should be
written.data
- the byte array of to be written.java.io.IOException
- on problems writing to the specified
stream.public void writeBlocks(java.io.OutputStream stream) throws java.io.IOException
writeBlocks
in interface BlockWritable
stream
- the OutputStream to which the stored data should
be writtenjava.io.IOException
- on problems writing to the specified
streamCopyright © 2014 Open Microscopy Environment