Package loci.poi.poifs.storage
Class BATBlock
java.lang.Object
loci.poi.poifs.storage.BATBlock
- All Implemented Interfaces:
BlockWritable
A block of block allocation table entries. BATBlocks are created
only through a static factory method: createBATBlocks.
- Author:
- Marc Johnson (mjohnson at apache dot org)
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcalculateStorageRequirements(int entryCount, int size) Calculate how many BATBlocks are needed to hold a specified number of BAT entries.static intcalculateXBATStorageRequirements(int entryCount, int size) Calculate how many XBATBlocks are needed to hold a specified number of BAT entries.static BATBlock[]createBATBlocks(int[] entries, int size) Create an array of BATBlocks from an array of int block allocation table entriesstatic BATBlock[]createXBATBlocks(int[] entries, int startBlock, int size) Create an array of XBATBlocks from an array of int block allocation table entriesprotected voiddoWriteData(OutputStream stream, byte[] data) Default implementation of write for extending classes that contain their data in a simple array of bytes.static final intentriesPerBlock(int size) static final intentriesPerXBATBlock(int size) intstatic final intgetXBATChainOffset(int size) voidwriteBlocks(OutputStream stream) Write the storage to an OutputStream
-
Method Details
-
getBigBlockSize
public int getBigBlockSize() -
createBATBlocks
Create an array of BATBlocks from an array of int block allocation table entries- Parameters:
entries- the array of int entries- Returns:
- the newly created array of BATBlocks
-
createXBATBlocks
Create an array of XBATBlocks from an array of int block allocation table entries- Parameters:
entries- the array of int entriesstartBlock- the start block of the array of XBAT blocks- Returns:
- the newly created array of BATBlocks
-
calculateStorageRequirements
public static int calculateStorageRequirements(int entryCount, int size) Calculate how many BATBlocks are needed to hold a specified number of BAT entries.- Parameters:
entryCount- the number of entries- Returns:
- the number of BATBlocks needed
-
calculateXBATStorageRequirements
public static int calculateXBATStorageRequirements(int entryCount, int size) Calculate how many XBATBlocks are needed to hold a specified number of BAT entries.- Parameters:
entryCount- the number of entries- Returns:
- the number of XBATBlocks needed
-
entriesPerBlock
public static final int entriesPerBlock(int size) - Returns:
- number of entries per block
-
entriesPerXBATBlock
public static final int entriesPerXBATBlock(int size) - Returns:
- number of entries per XBAT block
-
getXBATChainOffset
public static final int getXBATChainOffset(int size) - Returns:
- offset of chain index of XBAT block
-
doWriteData
Default implementation of write for extending classes that contain their data in a simple array of bytes.- Parameters:
stream- the OutputStream to which the data should be written.data- the byte array of to be written.- Throws:
IOException- on problems writing to the specified stream.
-
writeBlocks
Write the storage 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
-