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.filesystem
Class POIFSDocument

    java.lang.Object
      org.apache.poi.poifs.filesystem.POIFSDocument

All Implemented Interfaces:
  BATManaged, BlockWritable, POIFSViewable

public class POIFSDocument
extends java.lang.Object
implements BATManaged, BlockWritable, POIFSViewable

This class manages a document in the POIFS filesystem.

Author:
  Marc Johnson (mjohnson at apache dot org)

Constructor Summary
`POIFSDocument(java.lang.String name, java.io.InputStream stream)` Constructor
`POIFSDocument(java.lang.String name, int size, POIFSDocumentPath path, POIFSWriterListener writer)` Constructor
`POIFSDocument(java.lang.String name, ListManagedBlock[] blocks, int length)` Constructor from small blocks
`POIFSDocument(java.lang.String name, RawDataBlock[] blocks, int length)` Constructor from large blocks
`POIFSDocument(java.lang.String name, SmallDocumentBlock[] blocks, int length)` Constructor from small blocks

Method Summary
`int` | `countBlocks()` Return the number of BigBlock's this instance uses
`java.lang.String` | `getShortDescription()` Provides a short description of the object, to be used when a POIFSViewable object has not provided its contents.
`int` | `getSize()`
`BlockWritable[]` | `getSmallBlocks()` return the array of SmallDocumentBlocks used
`java.lang.Object[]` | `getViewableArray()` Get an array of objects, some of which may implement POIFSViewable
`java.util.Iterator` | `getViewableIterator()` Get an Iterator of objects, some of which may implement POIFSViewable
`boolean` | `preferArray()` Give viewers a hint as to whether to call getViewableArray or getViewableIterator
`void` | `setStartBlock(int index)` Set the start block for this instance
`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

### POIFSDocument

    public POIFSDocument(java.lang.String name,
                         RawDataBlock[] blocks,
                         int length)
                  throws java.io.IOException

  Constructor from large blocks

Parameters:
  `name` - the name of the POIFSDocument
  `blocks` - the big blocks making up the POIFSDocument
  `length` - the actual length of the POIFSDocument
Throws:
  `java.io.IOException`

### POIFSDocument

    public POIFSDocument(java.lang.String name,
                         SmallDocumentBlock[] blocks,
                         int length)

  Constructor from small blocks

Parameters:
  `name` - the name of the POIFSDocument
  `blocks` - the small blocks making up the POIFSDocument
  `length` - the actual length of the POIFSDocument

### POIFSDocument

    public POIFSDocument(java.lang.String name,
                         ListManagedBlock[] blocks,
                         int length)
                  throws java.io.IOException

  Constructor from small blocks

Parameters:
  `name` - the name of the POIFSDocument
  `blocks` - the small blocks making up the POIFSDocument
  `length` - the actual length of the POIFSDocument
Throws:
  `java.io.IOException`

### POIFSDocument

    public POIFSDocument(java.lang.String name,
                         java.io.InputStream stream)
                  throws java.io.IOException

  Constructor

Parameters:
  `name` - the name of the POIFSDocument
  `stream` - the InputStream we read data from
Throws:
  `java.io.IOException` - thrown on read errors

### POIFSDocument

    public POIFSDocument(java.lang.String name,
                         int size,
                         POIFSDocumentPath path,
                         POIFSWriterListener writer)
                  throws java.io.IOException

  Constructor

Parameters:
  `name` - the name of the POIFSDocument
  `size` - the length of the POIFSDocument
  `path` - the path of the POIFSDocument
  `writer` - the writer who will eventually write the document contents
Throws:
  `java.io.IOException` - thrown on read errors

Method Detail

### getSmallBlocks

    public BlockWritable[] getSmallBlocks()

  return the array of SmallDocumentBlocks used

  Returns:
    array of SmallDocumentBlocks; may be empty, cannot be null

### getSize

    public int getSize()

  Returns:
    size of the document

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

### countBlocks

    public int countBlocks()

  Return the number of BigBlock's this instance uses

  Specified by:
    `countBlocks` in interface `BATManaged`
  Returns:
    count of BigBlock instances

### setStartBlock

    public void setStartBlock(int index)

  Set the start block for this instance

  Specified by:
    `setStartBlock` in interface `BATManaged`
  Parameters:
    `index` - index into the array of blocks making up the filesystem

### getViewableArray

    public java.lang.Object[] getViewableArray()

  Get an array of objects, some of which may implement POIFSViewable

  Specified by:
    `getViewableArray` in interface `POIFSViewable`
  Returns:
    an array of Object; may not be null, but may be empty

### getViewableIterator

    public java.util.Iterator getViewableIterator()

  Get an Iterator of objects, some of which may implement POIFSViewable

  Specified by:
    `getViewableIterator` in interface `POIFSViewable`
  Returns:
    an Iterator; may not be null, but may have an empty back end store

### preferArray

    public boolean preferArray()

  Give viewers a hint as to whether to call getViewableArray or getViewableIterator

  Specified by:
    `preferArray` in interface `POIFSViewable`
  Returns:
    true if a viewer should call getViewableArray, false if a viewer should call getViewableIterator

### getShortDescription

    public java.lang.String getShortDescription()

  Provides a short description of the object, to be used when a POIFSViewable object has not provided its contents.

  Specified by:
    `getShortDescription` in interface `POIFSViewable`
  Returns:
    short description

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.