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

public Interface DirectoryEntry

extends Entry, Iterable<Entry>
Known Direct Implementers
org.apache.poi.poifs.filesystem.DirectoryNode, org.apache.poi.poifs.filesystem.FilteringDirectoryNode
Imports
java.io.FileNotFoundException, .IOException, .InputStream, java.util.Iterator, .Set, org.apache.poi.hpsf.ClassID

This interface defines methods specific to Directory objects managed by a Filesystem instance.

Method Summary

Modifier and TypeMethod and Description
public DirectoryEntry

Returns:

the new DirectoryEntry
createDirectory
(final String
the name of the new DirectoryEntry
name
)

create a new DirectoryEntry

public DocumentEntry

Returns:

the new DocumentEntry
createDocument
(final String
the name of the new DocumentEntry
name
,
final InputStream
the InputStream from which to create the new DocumentEntry
stream
)

create a new DocumentEntry

public DocumentEntry

Returns:

the new DocumentEntry
createDocument
(final String
the name of the new DocumentEntry
name
,
final int
the size of the new DocumentEntry
size
,
final POIFSWriterListener
the writer of the new DocumentEntry
writer
)

create a new DocumentEntry; the data will be provided later

public Iterator<Entry>

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.
getEntries
()

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

public Entry

Returns:

the specified Entry, if it is directly contained in this DirectoryEntry
getEntry
(final String
the name of the Entry to obtain.
name
)

get a specified Entry by name, case sensitive

public Entry

Returns:

the specified Entry, if it is directly contained in this DirectoryEntry
getEntryCaseInsensitive
(final String
the name of the Entry to obtain.
name
)

get a specified Entry by name, case insensitive

public int

Returns:

number of immediately (no grandchildren etc.) contained Entry instances
getEntryCount
()

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

public Set<String>

Returns:

the names of all the entries that may be retrieved with getEntry(String), which may be empty (if this DirectoryEntry is empty)
getEntryNames
()

get the names of all the Entries contained directly in this instance (in other words, names of children only; no grandchildren etc).

public ClassID

Returns:

storage Class ID
getStorageClsid
()

Gets the storage clsid of the directory entry

public boolean
hasEntry(final String name)

Checks if entry with specified name present, case sensitive

public boolean
hasEntryCaseInsensitive(final String name)

Checks if entry with specified name present, case sensitive

public boolean

Returns:

true if this instance contains no Entry instances
isEmpty
()

is this DirectoryEntry empty?

public void
setStorageClsid(ClassID
storage Class ID
clsidStorage
)

Sets the storage clsid for the directory entry

Inherited from java.lang.Iterable:
forEachiteratorspliterator
Inherited from org.apache.poi.poifs.filesystem.Entry:
deletegetNamegetParentisDirectoryEntryisDocumentEntryrenameTo

Method Detail

createDirectoryback to summary
public DirectoryEntry createDirectory(final String name) throws IOException

create a new DirectoryEntry

Parameters
name:String

the name of the new DirectoryEntry

Returns:DirectoryEntry

the new DirectoryEntry

createDocumentback to summary
public DocumentEntry createDocument(final String name, final InputStream stream) throws IOException

create a new DocumentEntry

Parameters
name:String

the name of the new DocumentEntry

stream:InputStream

the InputStream from which to create the new DocumentEntry

Returns:DocumentEntry

the new DocumentEntry

createDocumentback to summary
public DocumentEntry createDocument(final String name, final int size, final POIFSWriterListener writer) throws IOException

create a new DocumentEntry; the data will be provided later

Parameters
name:String

the name of the new DocumentEntry

size:int

the size of the new DocumentEntry

writer:POIFSWriterListener

the writer of the new DocumentEntry

Returns:DocumentEntry

the new DocumentEntry

getEntriesback to summary
public Iterator<Entry> getEntries()

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

Returns:Iterator<Entry>

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.

getEntryback to summary
public Entry getEntry(final String name) throws FileNotFoundException

get a specified Entry by name, case sensitive

Parameters
name:String

the name of the Entry to obtain.

Returns:Entry

the specified Entry, if it is directly contained in this DirectoryEntry

Exceptions
FileNotFoundException:
if no Entry with the specified name exists in this DirectoryEntry
getEntryCaseInsensitiveback to summary
public Entry getEntryCaseInsensitive(final String name) throws FileNotFoundException

get a specified Entry by name, case insensitive

Parameters
name:String

the name of the Entry to obtain.

Returns:Entry

the specified Entry, if it is directly contained in this DirectoryEntry

Exceptions
FileNotFoundException:
if no Entry with the specified name exists in this DirectoryEntry
getEntryCountback to summary
public int getEntryCount()

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

Returns:int

number of immediately (no grandchildren etc.) contained Entry instances

getEntryNamesback to summary
public Set<String> getEntryNames()

get the names of all the Entries contained directly in this instance (in other words, names of children only; no grandchildren etc).

Returns:Set<String>

the names of all the entries that may be retrieved with getEntry(String), which may be empty (if this DirectoryEntry is empty)

getStorageClsidback to summary
public ClassID getStorageClsid()

Gets the storage clsid of the directory entry

Returns:ClassID

storage Class ID

hasEntryback to summary
public boolean hasEntry(final String name)

Checks if entry with specified name present, case sensitive

hasEntryCaseInsensitiveback to summary
public boolean hasEntryCaseInsensitive(final String name)

Checks if entry with specified name present, case sensitive

isEmptyback to summary
public boolean isEmpty()

is this DirectoryEntry empty?

Returns:boolean

true if this instance contains no Entry instances

setStorageClsidback to summary
public void setStorageClsid(ClassID clsidStorage)

Sets the storage clsid for the directory entry

Parameters
clsidStorage:ClassID

storage Class ID