public class SmallDocumentBlock extends Object implements BlockWritable, ListManagedBlock
Modifier and Type | Field and Description |
---|---|
private static int |
_block_size |
private int |
_blocks_per_big_block |
private byte[] |
_data |
private static byte |
_default_fill |
Modifier | Constructor and Description |
---|---|
private |
SmallDocumentBlock(byte[] data,
int index,
int size) |
private |
SmallDocumentBlock(int size) |
Modifier and Type | Method and Description |
---|---|
static int |
calcSize(int size)
Calculate the storage size of a set of SmallDocumentBlocks
|
static SmallDocumentBlock[] |
convert(BlockWritable[] store,
int size)
Factory for creating SmallDocumentBlocks from DocumentBlocks
|
static SmallDocumentBlock[] |
convert(byte[] array,
int size)
convert a single long array into an array of SmallDocumentBlock
instances
|
private static int |
convertToBlockCount(int size) |
static List |
extract(ListManagedBlock[] blocks,
int size)
create a list of SmallDocumentBlock's from raw data
|
static int |
fill(List blocks,
int size)
fill out a List of SmallDocumentBlocks so that it fully occupies
a set of big blocks
|
int |
getBigBlockSize() |
byte[] |
getData()
Get the data from the block
|
private static SmallDocumentBlock |
makeEmptySmallDocumentBlock(int size) |
static void |
read(BlockWritable[] blocks,
byte[] buffer,
int offset)
read data from an array of SmallDocumentBlocks
|
void |
writeBlocks(OutputStream stream)
Write the storage to an OutputStream
|
private byte[] _data
private static final byte _default_fill
private static final int _block_size
private int _blocks_per_big_block
private SmallDocumentBlock(byte[] data, int index, int size)
private SmallDocumentBlock(int size)
public int getBigBlockSize()
public static SmallDocumentBlock[] convert(byte[] array, int size)
array
- the byte array to be convertedsize
- the intended size of the array (which may be smaller)public static int fill(List blocks, int size)
blocks
- the List to be filled outpublic static SmallDocumentBlock[] convert(BlockWritable[] store, int size) throws IOException, ArrayIndexOutOfBoundsException
store
- the original DocumentBlockssize
- the total document sizeIOException
- on errors reading from the DocumentBlocksArrayIndexOutOfBoundsException
- if, somehow, the store
contains less data than size indicatespublic static List extract(ListManagedBlock[] blocks, int size) throws IOException
blocks
- the raw data containing the SmallDocumentBlock
dataIOException
public static void read(BlockWritable[] blocks, byte[] buffer, int offset)
blocks
- the blocks to read frombuffer
- the buffer to write the data intooffset
- the offset into the array of blocks to read frompublic static int calcSize(int size)
size
- number of SmallDocumentBlocksprivate static SmallDocumentBlock makeEmptySmallDocumentBlock(int size)
private static int convertToBlockCount(int size)
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
streampublic byte[] getData() throws IOException
getData
in interface ListManagedBlock
IOException
- if there is no dataCopyright © 2016 Open Microscopy Environment