Class DocumentBlock
java.lang.Object
org.docx4j.org.apache.poi.poifs.storage.BigBlock
org.docx4j.org.apache.poi.poifs.storage.DocumentBlock
- All Implemented Interfaces:
BlockWritable
A block of document data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate byte[]private static final byteFields inherited from class org.docx4j.org.apache.poi.poifs.storage.BigBlock
bigBlockSize -
Constructor Summary
ConstructorsModifierConstructorDescriptionDocumentBlock(InputStream stream, POIFSBigBlockSize bigBlockSize) Create a single instance initialized with data.privateDocumentBlock(POIFSBigBlockSize bigBlockSize) Create a single instance initialized with default valuesDocumentBlock(RawDataBlock block) create a document block from a raw data block -
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentBlock[]convert(POIFSBigBlockSize bigBlockSize, byte[] array, int size) convert a single long array into an array of DocumentBlock instancesstatic DataInputBlockgetDataInputBlock(DocumentBlock[] blocks, int offset) static bytebooleanWas this a partially read block?intsize()Get the number of bytes read for this block(package private) voidwriteData(OutputStream stream) Write the block's data to an OutputStreamMethods inherited from class org.docx4j.org.apache.poi.poifs.storage.BigBlock
doWriteData, writeBlocks
-
Field Details
-
_default_value
private static final byte _default_value- See Also:
-
_data
private byte[] _data -
_bytes_read
private int _bytes_read
-
-
Constructor Details
-
DocumentBlock
create a document block from a raw data block- Parameters:
block- the raw data block- Throws:
IOException
-
DocumentBlock
Create a single instance initialized with data.- Parameters:
stream- the InputStream delivering the data.- Throws:
IOException
-
DocumentBlock
Create a single instance initialized with default values
-
-
Method Details
-
size
public int size()Get the number of bytes read for this block- Returns:
- bytes read into the block
-
partiallyRead
public boolean partiallyRead()Was this a partially read block?- Returns:
- true if the block was only partially filled with data
-
getFillByte
public static byte getFillByte()- Returns:
- the fill byte used
-
convert
convert a single long array into an array of DocumentBlock instances- Parameters:
array- the byte array to be convertedsize- the intended size of the array (which may be smaller)- Returns:
- an array of DocumentBlock instances, filled from the input array
-
getDataInputBlock
-
writeData
Write the block's data to an OutputStream- Specified by:
writeDatain classBigBlock- Parameters:
stream- the OutputStream to which the stored data should be written- Throws:
IOException- on problems writing to the specified stream
-