Top Description Fields Constructors Methods
org.apache.poi.poifs.filesystem

public final Class POIFSDocument

extends Object
implements POIFSViewable, Iterable<ByteBuffer>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable, org.apache.poi.poifs.dev.POIFSViewable
Static Imports
java.util.Collections.emptyIterator

This class manages a document in the NIO POIFS filesystem. This is the POIFSFileSystem version.

Field Summary

Modifier and TypeField and Description
private int
private POIFSFileSystem
private DocumentProperty
private POIFSStream

Constructor Summary

AccessConstructor and Description
public
POIFSDocument(DocumentNode document)

Constructor for an existing Document

public
POIFSDocument(DocumentProperty property, POIFSFileSystem filesystem)

Constructor for an existing Document

public
POIFSDocument(String
the name of the POIFSDocument
name
,
POIFSFileSystem filesystem, InputStream
the InputStream we read data from
stream
)

Constructor for a new Document

public
POIFSDocument(String name, final int size, POIFSFileSystem filesystem, POIFSWriterListener writer)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
free()

Frees the underlying stream and property

pack-priv Iterator<ByteBuffer>
pack-priv int
pack-priv DocumentProperty

Returns:

the instance's DocumentProperty
getDocumentProperty
()

pack-priv POIFSFileSystem
public String

Returns:

short description
getShortDescription
()

Implements org.apache.poi.poifs.dev.POIFSViewable.getShortDescription.

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

public int

Returns:

size of the document
getSize
()

public Object[]

Returns:

an array of Object; may not be null, but may be empty
getViewableArray
()

Implements org.apache.poi.poifs.dev.POIFSViewable.getViewableArray.

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

public Iterator<Object>

Returns:

an Iterator; may not be null, but may have an empty back end store
getViewableIterator
()

Implements org.apache.poi.poifs.dev.POIFSViewable.getViewableIterator.

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

public Iterator<ByteBuffer>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public boolean

Returns:

true if a viewer should call getViewableArray, false if a viewer should call getViewableIterator
preferArray
()

Implements org.apache.poi.poifs.dev.POIFSViewable.preferArray.

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

public void
private int
store(InputStream stream)

Stores the given data for this Document

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_block_sizeback to summary
private int _block_size
_filesystemback to summary
private POIFSFileSystem _filesystem
_propertyback to summary
private DocumentProperty _property
_streamback to summary
private POIFSStream _stream

Constructor Detail

POIFSDocumentback to summary
public POIFSDocument(DocumentNode document)

Constructor for an existing Document

POIFSDocumentback to summary
public POIFSDocument(DocumentProperty property, POIFSFileSystem filesystem)

Constructor for an existing Document

POIFSDocumentback to summary
public POIFSDocument(String name, POIFSFileSystem filesystem, InputStream stream) throws IOException

Constructor for a new Document

Parameters
name:String

the name of the POIFSDocument

stream:InputStream

the InputStream we read data from

POIFSDocumentback to summary
public POIFSDocument(String name, final int size, POIFSFileSystem filesystem, POIFSWriterListener writer) throws IOException

Method Detail

freeback to summary
pack-priv void free() throws IOException

Frees the underlying stream and property

getBlockIteratorback to summary
pack-priv Iterator<ByteBuffer> getBlockIterator()
getDocumentBlockSizeback to summary
pack-priv int getDocumentBlockSize()
getDocumentPropertyback to summary
pack-priv DocumentProperty getDocumentProperty()
Returns:DocumentProperty

the instance's DocumentProperty

getFileSystemback to summary
pack-priv POIFSFileSystem getFileSystem()
getShortDescriptionback to summary
public String getShortDescription()

Implements org.apache.poi.poifs.dev.POIFSViewable.getShortDescription.

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

Returns:String

short description

getSizeback to summary
public int getSize()
Returns:int

size of the document

getViewableArrayback to summary
public Object[] getViewableArray()

Implements org.apache.poi.poifs.dev.POIFSViewable.getViewableArray.

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

Returns:Object[]

an array of Object; may not be null, but may be empty

getViewableIteratorback to summary
public Iterator<Object> getViewableIterator()

Implements org.apache.poi.poifs.dev.POIFSViewable.getViewableIterator.

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

Returns:Iterator<Object>

an Iterator; may not be null, but may have an empty back end store

iteratorback to summary
public Iterator<ByteBuffer> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<ByteBuffer>

an Iterator.

Annotations
@Override
preferArrayback to summary
public boolean preferArray()

Implements org.apache.poi.poifs.dev.POIFSViewable.preferArray.

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

Returns:boolean

true if a viewer should call getViewableArray, false if a viewer should call getViewableIterator

replaceContentsback to summary
public void replaceContents(InputStream stream) throws IOException
storeback to summary
private int store(InputStream stream) throws IOException

Stores the given data for this Document