Class HeaderBlockWriter
java.lang.Object
org.docx4j.org.apache.poi.poifs.storage.HeaderBlockWriter
- All Implemented Interfaces:
BlockWritable,HeaderBlockConstants
The block containing the archive header
-
Field Summary
FieldsFields inherited from interface org.docx4j.org.apache.poi.poifs.storage.HeaderBlockConstants
_bat_array_offset, _bat_count_offset, _max_bats_in_header, _property_start_offset, _sbat_block_count_offset, _sbat_start_offset, _signature, _signature_offset, _xbat_count_offset, _xbat_start_offset -
Constructor Summary
ConstructorsConstructorDescriptionHeaderBlockWriter(POIFSBigBlockSize bigBlockSize) Create a single instance initialized with default valuesHeaderBlockWriter(HeaderBlock headerBlock) Create a single instance initialized with the specified existing values -
Method Summary
Modifier and TypeMethodDescription(package private) static intcalculateXBATStorageRequirements(POIFSBigBlockSize bigBlockSize, int blockCount) For a given number of BAT blocks, calculate how many XBAT blocks will be neededBATBlock[]setBATBlocks(int blockCount, int startBlock) Set BAT block parameters.voidsetPropertyStart(int startBlock) Set start of Property TablevoidsetSBATBlockCount(int count) Set count of SBAT blocksvoidsetSBATStart(int startBlock) Set start of small block allocation tablevoidwriteBlock(ByteBuffer block) Write the block's data to an existing blockvoidwriteBlocks(OutputStream stream) Write the block's data to an OutputStream
-
Field Details
-
_header_block
-
-
Constructor Details
-
HeaderBlockWriter
Create a single instance initialized with default values -
HeaderBlockWriter
Create a single instance initialized with the specified existing values
-
-
Method Details
-
setBATBlocks
Set BAT block parameters. Assumes that all BAT blocks are contiguous. Will construct XBAT blocks if necessary and return the array of newly constructed XBAT blocks.- Parameters:
blockCount- count of BAT blocksstartBlock- index of first BAT block- Returns:
- array of XBAT blocks; may be zero length, will not be null
-
setPropertyStart
public void setPropertyStart(int startBlock) Set start of Property Table- Parameters:
startBlock- the index of the first block of the Property Table
-
setSBATStart
public void setSBATStart(int startBlock) Set start of small block allocation table- Parameters:
startBlock- the index of the first big block of the small block allocation table
-
setSBATBlockCount
public void setSBATBlockCount(int count) Set count of SBAT blocks- Parameters:
count- the number of SBAT blocks
-
calculateXBATStorageRequirements
For a given number of BAT blocks, calculate how many XBAT blocks will be needed- Parameters:
blockCount- number of BAT blocks- Returns:
- number of XBAT blocks needed
-
writeBlocks
Write the block's data to an OutputStream- Specified by:
writeBlocksin interfaceBlockWritable- Parameters:
stream- the OutputStream to which the stored data should be written- Throws:
IOException- on problems writing to the specified stream
-
writeBlock
Write the block's data to an existing block- Parameters:
block- the ByteBuffer of the block to which the stored data should be written- Throws:
IOException- on problems writing to the block
-