Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.poifs.storage
Class HeaderBlockWriter

    java.lang.Object
      org.apache.poi.poifs.storage.HeaderBlockWriter

All Implemented Interfaces:
  BlockWritable, HeaderBlockConstants

    public class HeaderBlockWriter

extends java.lang.Object
implements HeaderBlockConstants

The block containing the archive header

Author:
  Marc Johnson (mjohnson at apache dot org)

Field Summary
`protected POIFSBigBlockSize` | `bigBlockSize` Either 512 bytes (`POIFSConstants.SMALLER_BIG_BLOCK_SIZE`) or 4096 bytes (`POIFSConstants.LARGER_BIG_BLOCK_SIZE`)

Fields inherited from interface 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
`HeaderBlockWriter(POIFSBigBlockSize bigBlockSize)` Create a single instance initialized with default values

Method Summary
`protected void` | `doWriteData(java.io.OutputStream stream, byte[] data)` Default implementation of write for extending classes that contain their data in a simple array of bytes.
`BATBlock[]` | `setBATBlocks(int blockCount, int startBlock)` Set BAT block parameters.
`void` | `setPropertyStart(int startBlock)` Set start of Property Table
`void` | `setSBATBlockCount(int count)` Set count of SBAT blocks
`void` | `setSBATStart(int startBlock)` Set start of small block allocation table
`void` | `writeBlocks(java.io.OutputStream stream)` Write the storage to an OutputStream

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### bigBlockSize

    protected POIFSBigBlockSize bigBlockSize

  Either 512 bytes (`POIFSConstants.SMALLER_BIG_BLOCK_SIZE`) or 4096 bytes (`POIFSConstants.LARGER_BIG_BLOCK_SIZE`)

Constructor Detail

### HeaderBlockWriter

    public HeaderBlockWriter(POIFSBigBlockSize bigBlockSize)

  Create a single instance initialized with default values

Method Detail

### setBATBlocks

    public BATBlock[] setBATBlocks(int blockCount,
                                   int startBlock)

  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 blocks
    `startBlock` - 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

### doWriteData

    protected void doWriteData(java.io.OutputStream stream,
                               byte[] data)
                        throws java.io.IOException

  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:
    `java.io.IOException` - on problems writing to the specified stream.

### 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2010 The Apache Software Foundation or its licensors, as applicable.