public class POIFSFileSystem extends Object implements POIFSViewable
Modifier and Type | Field and Description |
---|---|
private List |
_documents |
private PropertyTable |
_property_table |
private DirectoryNode |
_root |
private int |
bigBlockSize |
private RandomAccessInputStream |
stream |
Constructor and Description |
---|
POIFSFileSystem()
Constructor, intended for writing
|
POIFSFileSystem(RandomAccessInputStream stream,
int size)
Create a POIFSFileSystem from an InputStream
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addDirectory(DirectoryProperty directory)
add a new DirectoryProperty
|
(package private) void |
addDocument(POIFSDocument document)
add a new POIFSDocument
|
DirectoryEntry |
createDirectory(String name)
create a new DirectoryEntry in the root directory
|
DocumentEntry |
createDocument(RandomAccessInputStream stream,
String name)
Create a new document to be added to the root directory
|
DocumentEntry |
createDocument(String name,
int size,
POIFSWriterListener writer)
create a new DocumentEntry in the root entry; the data will be
provided later
|
DocumentInputStream |
createDocumentInputStream(String documentName)
open a document in the root entry's list of entries
|
DirectoryEntry |
getRoot()
get the root entry
|
String |
getShortDescription()
Provides a short description of the object, to be used when a
POIFSViewable object has not provided its contents.
|
Object[] |
getViewableArray()
Get an array of objects, some of which may implement
POIFSViewable
|
Iterator |
getViewableIterator()
Get an Iterator of objects, some of which may implement
POIFSViewable
|
static void |
main(String[] args)
read in a file and write it back out again
|
boolean |
preferArray()
Give viewers a hint as to whether to call getViewableArray or
getViewableIterator
|
private void |
processProperties(BlockList small_blocks,
BlockList big_blocks,
Iterator properties,
DirectoryNode dir) |
(package private) void |
remove(EntryNode entry)
remove an entry
|
void |
writeFilesystem(OutputStream stream)
Write the filesystem out
|
private PropertyTable _property_table
private List _documents
private DirectoryNode _root
private int bigBlockSize
private RandomAccessInputStream stream
public POIFSFileSystem()
public POIFSFileSystem(RandomAccessInputStream stream, int size) throws IOException
stream
- the InputStream from which to read the dataIOException
- on errors reading, or on invalid datapublic DocumentEntry createDocument(RandomAccessInputStream stream, String name) throws IOException
stream
- the InputStream from which the document's data
will be obtainedname
- the name of the new POIFSDocumentIOException
- on error creating the new POIFSDocumentpublic DocumentEntry createDocument(String name, int size, POIFSWriterListener writer) throws IOException
name
- the name of the new DocumentEntrysize
- the size of the new DocumentEntrywriter
- the writer of the new DocumentEntryIOException
public DirectoryEntry createDirectory(String name) throws IOException
name
- the name of the new DirectoryEntryIOException
- on name duplicationpublic void writeFilesystem(OutputStream stream) throws IOException
stream
- the OutputStream to which the filesystem will be
writtenIOException
- thrown on errors writing to the streampublic static void main(String[] args) throws IOException
args
- names of the files; arg[ 0 ] is the input file,
arg[ 1 ] is the output fileIOException
public DirectoryEntry getRoot()
public DocumentInputStream createDocumentInputStream(String documentName) throws IOException
documentName
- the name of the document to be openedIOException
- if the document does not exist or the
name is that of a DirectoryEntryvoid addDocument(POIFSDocument document)
document
- the POIFSDocument being addedvoid addDirectory(DirectoryProperty directory)
directory
- the DirectoryProperty being addedvoid remove(EntryNode entry)
entry
- to be removedprivate void processProperties(BlockList small_blocks, BlockList big_blocks, Iterator properties, DirectoryNode dir) throws IOException
IOException
public Object[] getViewableArray()
getViewableArray
in interface POIFSViewable
public Iterator getViewableIterator()
getViewableIterator
in interface POIFSViewable
public boolean preferArray()
preferArray
in interface POIFSViewable
public String getShortDescription()
getShortDescription
in interface POIFSViewable
Copyright © 2015 Open Microscopy Environment