org.apache.poi.poifs.storage
Class BATBlock

java.lang.Object
  extended by org.apache.poi.poifs.storage.BATBlock
All Implemented Interfaces:
BlockWritable

public final class BATBlock
extends java.lang.Object

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
static int calculateStorageRequirements(POIFSBigBlockSize bigBlockSize, int entryCount)
          Calculate how many BATBlocks are needed to hold a specified number of BAT entries.
static int calculateXBATStorageRequirements(POIFSBigBlockSize bigBlockSize, int entryCount)
          Calculate how many XBATBlocks are needed to hold a specified number of BAT entries.
static BATBlock[] createBATBlocks(POIFSBigBlockSize bigBlockSize, int[] entries)
          Create an array of BATBlocks from an array of int block allocation table entries
static BATBlock[] createXBATBlocks(POIFSBigBlockSize bigBlockSize, int[] entries, int startBlock)
          Create an array of XBATBlocks from an array of int block allocation table entries
 void writeBlocks(java.io.OutputStream stream)
          Write the storage to an OutputStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createBATBlocks

public static BATBlock[] createBATBlocks(POIFSBigBlockSize bigBlockSize,
                                         int[] entries)
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

public static BATBlock[] createXBATBlocks(POIFSBigBlockSize bigBlockSize,
                                          int[] entries,
                                          int startBlock)
Create an array of XBATBlocks from an array of int block allocation table entries

Parameters:
entries - the array of int entries
startBlock - the start block of the array of XBAT blocks
Returns:
the newly created array of BATBlocks

calculateStorageRequirements

public static int calculateStorageRequirements(POIFSBigBlockSize bigBlockSize,
                                               int entryCount)
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(POIFSBigBlockSize bigBlockSize,
                                                   int entryCount)
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

writeBlocks

public void writeBlocks(java.io.OutputStream stream)
                 throws java.io.IOException
Write the storage to an OutputStream

Specified by:
writeBlocks in interface BlockWritable
Parameters:
stream - the OutputStream to which the stored data should be written
Throws:
java.io.IOException - on problems writing to the specified stream