public final class SmallDocumentBlock extends Object implements BlockWritable, ListManagedBlock
Modifier and Type | Method and Description |
---|---|
static int |
calcSize(int size)
Calculate the storage size of a set of SmallDocumentBlocks
|
static SmallDocumentBlock[] |
convert(POIFSBigBlockSize bigBlockSize,
BlockWritable[] store,
int size)
Factory for creating SmallDocumentBlocks from DocumentBlocks
|
static SmallDocumentBlock[] |
convert(POIFSBigBlockSize bigBlockSize,
byte[] array,
int size)
convert a single long array into an array of SmallDocumentBlock
instances
|
static List |
extract(POIFSBigBlockSize bigBlockSize,
ListManagedBlock[] blocks)
create a list of SmallDocumentBlock's from raw data
|
static int |
fill(POIFSBigBlockSize bigBlockSize,
List blocks)
fill out a List of SmallDocumentBlocks so that it fully occupies
a set of big blocks
|
POIFSBigBlockSize |
getBigBlockSize() |
byte[] |
getData()
Get the data from the block
|
static DataInputBlock |
getDataInputBlock(SmallDocumentBlock[] blocks,
int offset) |
void |
writeBlocks(OutputStream stream)
Write the storage to an OutputStream
|
public static SmallDocumentBlock[] convert(POIFSBigBlockSize bigBlockSize, 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(POIFSBigBlockSize bigBlockSize, List blocks)
blocks
- the List to be filled outpublic static SmallDocumentBlock[] convert(POIFSBigBlockSize bigBlockSize, 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(POIFSBigBlockSize bigBlockSize, ListManagedBlock[] blocks) throws IOException
blocks
- the raw data containing the SmallDocumentBlock
dataIOException
public static DataInputBlock getDataInputBlock(SmallDocumentBlock[] blocks, int offset)
public static int calcSize(int size)
size
- number of SmallDocumentBlockspublic 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()
getData
in interface ListManagedBlock
IOException
- if there is no datapublic POIFSBigBlockSize getBigBlockSize()
Copyright © 2020. All rights reserved.