Save This Page
Home » cocoon-2.1.11-src » org.apache.cocoon.poi.poifs » storage » [javadoc | source]
org.apache.cocoon.poi.poifs.storage
public class: BlockAllocationTable [javadoc | source]
java.lang.Object
   org.apache.cocoon.poi.poifs.storage.BlockAllocationTable

All Implemented Interfaces:
    BlockWritable, BATManaged

This class manages and creates the Block Allocation Table, which is basically a set of linked lists of block indices.

Each block of the filesystem has an index. The first block, the header, is skipped; the first block after the header is index 0, the next is index 1, and so on.

A block's index is also its index into the Block Allocation Table. The entry that it finds in the Block Allocation Table is the index of the next block in the linked list of blocks making up a file, or it is set to -2: end of list.

Constructor:
 public BlockAllocationTable() 
 BlockAllocationTable(ListManagedBlock[] blocks,
    BlockList raw_block_list) throws IOException 
    create a BlockAllocationTable from an array of raw data blocks
    Parameters:
    blocks - the raw data
    raw_block_list - the list holding the managed blocks
    Throws:
    IOException -
    exception: IOException -
 public BlockAllocationTable(int block_count,
    int[] block_array,
    int xbat_count,
    int xbat_index,
    BlockList raw_block_list) throws IOException 
    create a BlockAllocationTable for an existing filesystem. Side effect: when this method finishes, the BAT blocks will have been removed from the raw block list, and any blocks labeled as 'unused' in the block allocation table will also have been removed from the raw block list.
    Parameters:
    block_count - the number of BAT blocks making up the block allocation table
    block_array - the array of BAT block indices from the filesystem's header
    xbat_count - the number of XBAT blocks
    xbat_index - the index of the first XBAT block
    raw_block_list - the list of RawDataBlocks
    Throws:
    IOException - if, in trying to create the table, we encounter logic errors
    exception: IOException - if, in trying to create the table, we encounter logic errors
Method from org.apache.cocoon.poi.poifs.storage.BlockAllocationTable Summary:
allocateSpace,   countBlocks,   createBlocks,   fetchBlocks,   getNextBlockIndex,   getStartBlock,   isUsed,   setStartBlock,   simpleCreateBlocks,   writeBlocks
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.cocoon.poi.poifs.storage.BlockAllocationTable Detail:
 public int allocateSpace(int blockCount) 
    Allocate space for a block of indices
 public int countBlocks() 
    Get the number of BAT blocks
 public int createBlocks() 
    Create the BATBlocks we need
 ListManagedBlock[] fetchBlocks(int startBlock,
    BlockList blockList) throws IOException 
    walk the entries from a specified point and return the associated blocks. The associated blocks are removed from the block list
 int getNextBlockIndex(int index) throws IOException 
    return the next block index
 public int getStartBlock() 
    get the starting block
 boolean isUsed(int index) 
    determine whether the block specified by index is used or not
 public  void setStartBlock(int start_block) 
    set the start block
  void simpleCreateBlocks() 
    create the BATBlocks
 public  void writeBlocks(OutputStream stream) throws IOException 
    Write the storage to an OutputStream