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 DocumentBlock

    java.lang.Object
      org.apache.poi.poifs.storage.BigBlock
          org.apache.poi.poifs.storage.DocumentBlock

All Implemented Interfaces:
  BlockWritable

public class DocumentBlock
extends org.apache.poi.poifs.storage.BigBlock

A block of document data.

Author:
  Marc Johnson (mjohnson at apache dot org)

Constructor Summary
`DocumentBlock(java.io.InputStream stream)` Create a single instance initialized with data.
`DocumentBlock(RawDataBlock block)` create a document block from a raw data block

Method Summary
`static DocumentBlock[]` | `convert(byte[] array, int size)` convert a single long array into an array of DocumentBlock instances
`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.
`static byte` | `getFillByte()`
`boolean` | `partiallyRead()` Was this a partially read block?
`static void` | `read(DocumentBlock[] blocks, byte[] buffer, int offset)` read data from an array of DocumentBlocks
`int` | `size()` Get the number of bytes read for this block
`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`

Constructor Detail

### DocumentBlock

    public DocumentBlock(RawDataBlock block)
                  throws java.io.IOException

  create a document block from a raw data block

Parameters:
  `block` - the raw data block
Throws:
  `java.io.IOException`

### DocumentBlock

    public DocumentBlock(java.io.InputStream stream)
                  throws java.io.IOException

  Create a single instance initialized with data.

Parameters:
  `stream` - the InputStream delivering the data.
Throws:
  `java.io.IOException`

Method Detail

### size

    public int size()

  Get the number of bytes read for this block

  Returns:
    bytes read into the block

### partiallyRead

    public boolean partiallyRead()

  Was this a partially read block?

  Returns:
    true if the block was only partially filled with data

### getFillByte

    public static byte getFillByte()

  Returns:
    the fill byte used

### convert

    public static DocumentBlock[] convert(byte[] array,
                                          int size)

  convert a single long array into an array of DocumentBlock instances

  Parameters:
    `array` - the byte array to be converted
    `size` - the intended size of the array (which may be smaller)
  Returns:
    an array of DocumentBlock instances, filled from the input array

### read

    public static void read(DocumentBlock[] blocks,
                            byte[] buffer,
                            int offset)

  read data from an array of DocumentBlocks

  Parameters:
    `blocks` - the blocks to read from
    `buffer` - the buffer to write the data into
    `offset` - the offset into the array of blocks to read from

### 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 © 2003 Apache Software Foundation.