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 DirectoryNode

    java.lang.Object
      org.apache.poi.poifs.filesystem.EntryNode
          org.apache.poi.poifs.filesystem.DirectoryNode

All Implemented Interfaces:
  POIFSViewable, DirectoryEntry, Entry, Iterable

    public class DirectoryNode

extends EntryNode
implements DirectoryEntry, POIFSViewable, Iterable

Simple implementation of DirectoryEntry

Author:
  Marc Johnson (mjohnson at apache dot org)

Method Summary
`DirectoryEntry` | `createDirectory(java.lang.String name)` create a new DirectoryEntry
`DocumentEntry` | `createDocument(java.lang.String name, java.io.InputStream stream)` create a new DocumentEntry
`DocumentEntry` | `createDocument(java.lang.String name, int size, POIFSWriterListener writer)` create a new DocumentEntry; the data will be provided later
`DocumentInputStream` | `createDocumentInputStream(Entry document)` open a document in the directory's entry's list of entries
`DocumentInputStream` | `createDocumentInputStream(java.lang.String documentName)` open a document in the directory's entry's list of entries
`java.util.Iterator` | `getEntries()` get an iterator of the Entry instances contained directly in this instance (in other words, children only; no grandchildren etc.)
`Entry` | `getEntry(java.lang.String name)` get a specified Entry by name
`int` | `getEntryCount()` find out how many Entry instances are contained directly within this DirectoryEntry
`POIFSFileSystem` | `getFileSystem()`
`NPOIFSFileSystem` | `getNFileSystem()`
`POIFSDocumentPath` | `getPath()`
`java.lang.String` | `getShortDescription()` Provides a short description of the object, to be used when a POIFSViewable object has not provided its contents.
`ClassID` | `getStorageClsid()` Gets the storage clsid of the directory entry
`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` | `hasEntry(java.lang.String name)` Checks if entry with specified name present
`boolean` | `isDirectoryEntry()` is this a DirectoryEntry?
`boolean` | `isEmpty()` is this DirectoryEntry empty?
`java.util.Iterator` | `iterator()` Returns an Iterator over all the entries
`boolean` | `preferArray()` Give viewers a hint as to whether to call getViewableArray or getViewableIterator
`void` | `setStorageClsid(ClassID clsidStorage)` Sets the storage clsid for the directory entry

Methods inherited from class org.apache.poi.poifs.filesystem.EntryNode
`delete, getName, getParent, isDocumentEntry, renameTo`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.poi.poifs.filesystem.Entry
`delete, getName, getParent, isDocumentEntry, renameTo`

Method Detail

### getPath

    public POIFSDocumentPath getPath()

  Returns:
    this directory's path representation

### getFileSystem

    public POIFSFileSystem getFileSystem()

  Returns:
    the filesystem that this belongs to

### getNFileSystem

    public NPOIFSFileSystem getNFileSystem()

  Returns:
    the filesystem that this belongs to

### createDocumentInputStream

    public DocumentInputStream createDocumentInputStream(java.lang.String documentName)
                                                  throws java.io.IOException

  open a document in the directory's entry's list of entries

  Parameters:
    `documentName` - the name of the document to be opened
  Returns:
    a newly opened DocumentInputStream
  Throws:
    `java.io.IOException` - if the document does not exist or the name is that of a DirectoryEntry

### createDocumentInputStream

    public DocumentInputStream createDocumentInputStream(Entry document)
                                                  throws java.io.IOException

  open a document in the directory's entry's list of entries

  Parameters:
    `document` - the document to be opened
  Returns:
    a newly opened DocumentInputStream or NDocumentInputStream
  Throws:
    `java.io.IOException` - if the document does not exist or the name is that of a DirectoryEntry

### getEntries

    public java.util.Iterator getEntries()

  get an iterator of the Entry instances contained directly in this instance (in other words, children only; no grandchildren etc.)

  Specified by:
    `getEntries` in interface `DirectoryEntry`
  Returns:
    iterator; never null, but hasNext() may return false immediately (i.e., this DirectoryEntry is empty). All objects retrieved by next() are guaranteed to be implementations of Entry.

### isEmpty

    public boolean isEmpty()

  is this DirectoryEntry empty?

  Specified by:
    `isEmpty` in interface `DirectoryEntry`
  Returns:
    true if this instance contains no Entry instances

### getEntryCount

    public int getEntryCount()

  find out how many Entry instances are contained directly within this DirectoryEntry

  Specified by:
    `getEntryCount` in interface `DirectoryEntry`
  Returns:
    number of immediately (no grandchildren etc.) contained Entry instances

### hasEntry

    public boolean hasEntry(java.lang.String name)

  Description copied from interface: `DirectoryEntry`
  Checks if entry with specified name present

  Specified by:
    `hasEntry` in interface `DirectoryEntry`

### getEntry

    public Entry getEntry(java.lang.String name)
                   throws java.io.FileNotFoundException

  get a specified Entry by name

  Specified by:
    `getEntry` in interface `DirectoryEntry`
  Parameters:
    `name` - the name of the Entry to obtain.
  Returns:
    the specified Entry, if it is directly contained in this DirectoryEntry
  Throws:
    `java.io.FileNotFoundException` - if no Entry with the specified name exists in this DirectoryEntry

### createDocument

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

  create a new DocumentEntry

  Specified by:
    `createDocument` in interface `DirectoryEntry`
  Parameters:
    `name` - the name of the new DocumentEntry
    `stream` - the InputStream from which to create the new DocumentEntry
  Returns:
    the new DocumentEntry
  Throws:
    `java.io.IOException`

### createDocument

    public DocumentEntry createDocument(java.lang.String name,
                                        int size,
                                        POIFSWriterListener writer)
                                 throws java.io.IOException

  create a new DocumentEntry; the data will be provided later

  Specified by:
    `createDocument` in interface `DirectoryEntry`
  Parameters:
    `name` - the name of the new DocumentEntry
    `size` - the size of the new DocumentEntry
    `writer` - the writer of the new DocumentEntry
  Returns:
    the new DocumentEntry
  Throws:
    `java.io.IOException`

### createDirectory

    public DirectoryEntry createDirectory(java.lang.String name)
                                   throws java.io.IOException

  create a new DirectoryEntry

  Specified by:
    `createDirectory` in interface `DirectoryEntry`
  Parameters:
    `name` - the name of the new DirectoryEntry
  Returns:
    the new DirectoryEntry
  Throws:
    `java.io.IOException`

### getStorageClsid

    public ClassID getStorageClsid()

  Gets the storage clsid of the directory entry

  Specified by:
    `getStorageClsid` in interface `DirectoryEntry`
  Returns:
    storage Class ID

### setStorageClsid

    public void setStorageClsid(ClassID clsidStorage)

  Sets the storage clsid for the directory entry

  Specified by:
    `setStorageClsid` in interface `DirectoryEntry`
  Parameters:
    `clsidStorage` - storage Class ID

### isDirectoryEntry

    public boolean isDirectoryEntry()

  is this a DirectoryEntry?

  Specified by:
    `isDirectoryEntry` in interface `Entry`
  Overrides:
    `isDirectoryEntry` in class `EntryNode`
  Returns:
    true if the Entry is a DirectoryEntry, else false

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

### iterator

    public java.util.Iterator iterator()

  Returns an Iterator over all the entries

  Specified by:
    `iterator` in interface `Iterable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD