Class OPOIFSDocument
java.lang.Object
org.docx4j.org.apache.poi.poifs.filesystem.OPOIFSDocument
- All Implemented Interfaces:
POIFSViewable,BATManaged,BlockWritable
public final class OPOIFSDocument
extends Object
implements BATManaged, BlockWritable, POIFSViewable
This class manages a document in a old-style
OPOIFS filesystem.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate OPOIFSDocument.BigBlockStoreprivate final POIFSBigBlockSizeprivate DocumentPropertyprivate intprivate OPOIFSDocument.SmallBlockStoreprivate static final DocumentBlock[]private static final SmallDocumentBlock[] -
Constructor Summary
ConstructorsConstructorDescriptionOPOIFSDocument(String name, int size, POIFSBigBlockSize bigBlockSize, POIFSDocumentPath path, POIFSWriterListener writer) ConstructorOPOIFSDocument(String name, int size, POIFSDocumentPath path, POIFSWriterListener writer) OPOIFSDocument(String name, InputStream stream) OPOIFSDocument(String name, POIFSBigBlockSize bigBlockSize, InputStream stream) ConstructorOPOIFSDocument(String name, POIFSBigBlockSize bigBlockSize, ListManagedBlock[] blocks, int length) Constructor from small blocksOPOIFSDocument(String name, ListManagedBlock[] blocks, int length) OPOIFSDocument(String name, RawDataBlock[] blocks, int length) Constructor from large blocksOPOIFSDocument(String name, SmallDocumentBlock[] blocks, int length) Constructor from small blocks -
Method Summary
Modifier and TypeMethodDescriptionprivate static DocumentBlock[]convertRawBlocksToBigBlocks(ListManagedBlock[] blocks) private static SmallDocumentBlock[]intReturn the number of BigBlock's this instance uses(package private) DataInputBlockgetDataInputBlock(int offset) (package private) DocumentPropertyProvides a short description of the object, to be used when a POIFSViewable object has not provided its contents.intgetSize()Object[]Get an array of objects, some of which may implement POIFSViewableGet an Iterator of objects, some of which may implement POIFSViewablebooleanGive viewers a hint as to whether to call getViewableArray or getViewableIterator(package private) voidread(byte[] buffer, int offset) read data from the internal storesvoidsetStartBlock(int index) Set the start block for this instancevoidwriteBlocks(OutputStream stream) Write the storage to an OutputStream
-
Field Details
-
EMPTY_BIG_BLOCK_ARRAY
-
EMPTY_SMALL_BLOCK_ARRAY
-
_property
-
_size
private int _size -
_bigBigBlockSize
-
_small_store
-
_big_store
-
-
Constructor Details
-
OPOIFSDocument
Constructor from large blocks- Parameters:
name- the name of the POIFSDocumentblocks- the big blocks making up the POIFSDocumentlength- the actual length of the POIFSDocument- Throws:
IOException
-
OPOIFSDocument
Constructor from small blocks- Parameters:
name- the name of the POIFSDocumentblocks- the small blocks making up the POIFSDocumentlength- the actual length of the POIFSDocument
-
OPOIFSDocument
public OPOIFSDocument(String name, POIFSBigBlockSize bigBlockSize, ListManagedBlock[] blocks, int length) throws IOException Constructor from small blocks- Parameters:
name- the name of the POIFSDocumentblocks- the small blocks making up the POIFSDocumentlength- the actual length of the POIFSDocument- Throws:
IOException
-
OPOIFSDocument
- Throws:
IOException
-
OPOIFSDocument
public OPOIFSDocument(String name, POIFSBigBlockSize bigBlockSize, InputStream stream) throws IOException Constructor- Parameters:
name- the name of the POIFSDocumentstream- the InputStream we read data from- Throws:
IOException
-
OPOIFSDocument
- Throws:
IOException
-
OPOIFSDocument
public OPOIFSDocument(String name, int size, POIFSBigBlockSize bigBlockSize, POIFSDocumentPath path, POIFSWriterListener writer) Constructor- Parameters:
name- the name of the POIFSDocumentsize- the length of the POIFSDocumentpath- the path of the POIFSDocumentwriter- the writer who will eventually write the document contents
-
OPOIFSDocument
-
-
Method Details
-
convertRawBlocksToBigBlocks
private static DocumentBlock[] convertRawBlocksToBigBlocks(ListManagedBlock[] blocks) throws IOException - Throws:
IOException
-
convertRawBlocksToSmallBlocks
-
getSmallBlocks
- Returns:
- array of SmallDocumentBlocks; may be empty, cannot be null
-
getSize
public int getSize()- Returns:
- size of the document
-
read
void read(byte[] buffer, int offset) read data from the internal stores- Parameters:
buffer- the buffer to write tooffset- the offset into our storage to read from This method is currently (Oct 2008) only used by test code. Perhaps it can be deleted
-
getDataInputBlock
- Returns:
nullif offset points to the end of the document stream
-
getDocumentProperty
DocumentProperty getDocumentProperty()- Returns:
- the instance's DocumentProperty
-
writeBlocks
Write the storage to an OutputStream- Specified by:
writeBlocksin interfaceBlockWritable- Parameters:
stream- the OutputStream to which the stored data should be written- Throws:
IOException- on problems writing to the specified stream
-
countBlocks
public int countBlocks()Return the number of BigBlock's this instance uses- Specified by:
countBlocksin interfaceBATManaged- Returns:
- count of BigBlock instances
-
setStartBlock
public void setStartBlock(int index) Set the start block for this instance- Specified by:
setStartBlockin interfaceBATManaged- Parameters:
index- index into the array of blocks making up the filesystem
-
getViewableArray
Get an array of objects, some of which may implement POIFSViewable- Specified by:
getViewableArrayin interfacePOIFSViewable- Returns:
- an array of Object; may not be null, but may be empty
-
getViewableIterator
Get an Iterator of objects, some of which may implement POIFSViewable- Specified by:
getViewableIteratorin interfacePOIFSViewable- 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:
preferArrayin interfacePOIFSViewable- Returns:
trueif a viewer should call getViewableArray,falseif a viewer should call getViewableIterator
-
getShortDescription
Provides a short description of the object, to be used when a POIFSViewable object has not provided its contents.- Specified by:
getShortDescriptionin interfacePOIFSViewable- Returns:
- short description
-