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

public Class FilteringDirectoryNode

extends Object
implements DirectoryEntry
Class Inheritance
All Implemented Interfaces
org.apache.poi.poifs.filesystem.DirectoryEntry, java.lang.Iterable, org.apache.poi.poifs.filesystem.Entry
Imports
java.io.FileNotFoundException, .IOException, .InputStream, java.util.ArrayList, .Collection, .HashMap, .HashSet, .Iterator, .List, .Map, .NoSuchElementException, .Set, .Spliterator, .Spliterators, org.apache.poi.hpsf.ClassID

A DirectoryEntry filter, which exposes another DirectoryEntry less certain parts. This is typically used when copying or comparing Filesystems.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final Map<String, List<String>>
childExcludes

Excludes of our child directories

private final DirectoryEntry
private final Set<String>
excludes

The names of our entries to exclude

Constructor Summary

AccessConstructor and Description
public
FilteringDirectoryNode(DirectoryEntry
The Directory to filter
directory
,
Collection<String>
The Entries to exclude
excludes
)

Creates a filter round the specified directory, which will exclude entries such as "MyNode" and "MyDir/IgnoreNode".

Method Summary

Modifier and TypeMethod and Description
public DirectoryEntry
createDirectory(String
the name of the new DirectoryEntry
name
)

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.createDirectory.

create a new DirectoryEntry

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

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.createDocument.

create a new DocumentEntry

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

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.createDocument.

create a new DocumentEntry; the data will be provided later

public boolean
delete()

Implements org.apache.poi.poifs.filesystem.Entry.delete.

Delete this Entry.

public Iterator<Entry>
getEntries()

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getEntries.

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

public Entry
getEntry(String
the name of the Entry to obtain.
name
)

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getEntry.

get a specified Entry by name, case sensitive

public Entry
getEntryCaseInsensitive(String
the name of the Entry to obtain.
name
)

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getEntryCaseInsensitive.

get a specified Entry by name, case insensitive

public int
getEntryCount()

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getEntryCount.

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

public Set<String>
getEntryNames()

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getEntryNames.

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

public String
getName()

Implements org.apache.poi.poifs.filesystem.Entry.getName.

get the name of the Entry

public DirectoryEntry
getParent()

Implements org.apache.poi.poifs.filesystem.Entry.getParent.

get this Entry's parent (the DirectoryEntry that owns this Entry).

public ClassID
getStorageClsid()

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getStorageClsid.

Gets the storage clsid of the directory entry

public boolean
hasEntry(String name)

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.hasEntry.

Checks if entry with specified name present, case sensitive

public boolean
hasEntryCaseInsensitive(String name)

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.hasEntryCaseInsensitive.

Checks if entry with specified name present, case sensitive

public boolean
public boolean
public boolean
isEmpty()

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.isEmpty.

is this DirectoryEntry empty?

public Iterator<Entry>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public boolean
renameTo(String
the new name for this Entry
newName
)

Implements org.apache.poi.poifs.filesystem.Entry.renameTo.

Rename this Entry.

public void
setStorageClsid(ClassID
storage Class ID
clsidStorage
)

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.setStorageClsid.

Sets the storage clsid for the directory entry

public Spliterator<Entry>
spliterator()

Overrides default java.lang.Iterable.spliterator.

Creates a Spliterator over the elements described by this Iterable.

private Entry
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

childExcludesback to summary
private final Map<String, List<String>> childExcludes

Excludes of our child directories

directoryback to summary
private final DirectoryEntry directory
excludesback to summary
private final Set<String> excludes

The names of our entries to exclude

Constructor Detail

FilteringDirectoryNodeback to summary
public FilteringDirectoryNode(DirectoryEntry directory, Collection<String> excludes)

Creates a filter round the specified directory, which will exclude entries such as "MyNode" and "MyDir/IgnoreNode". The excludes can stretch into children, if they contain a /.

Parameters
directory:DirectoryEntry

The Directory to filter

excludes:Collection<String>

The Entries to exclude

Exceptions
IllegalArgumentException:
if directory is null

Method Detail

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

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.createDirectory.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.createDirectory.

create a new DirectoryEntry

Parameters
name:String

the name of the new DirectoryEntry

Returns:DirectoryEntry

the new DirectoryEntry

Annotations
@Override
createDocumentback to summary
public DocumentEntry createDocument(String name, InputStream stream) throws IOException

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.createDocument.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.createDocument.

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

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

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.createDocument.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.createDocument.

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

Annotations
@Override
deleteback to summary
public boolean delete()

Implements org.apache.poi.poifs.filesystem.Entry.delete.

Doc from org.apache.poi.poifs.filesystem.Entry.delete.

Delete this Entry. This operation should succeed, but there are special circumstances when it will not: If this Entry is the root of the Entry tree, it cannot be deleted, as there is no way to create another one. If this Entry is a directory, it cannot be deleted unless it is empty.

Returns:boolean

true if the Entry was successfully deleted, else false

Annotations
@Override
getEntriesback to summary
public Iterator<Entry> getEntries()

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getEntries.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.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.

Annotations
@Override
getEntryback to summary
public Entry getEntry(String name) throws FileNotFoundException

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getEntry.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.getEntry.

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

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

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getEntryCaseInsensitive.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.getEntryCaseInsensitive.

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

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

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getEntryCount.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.getEntryCount.

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

Returns:int

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

Annotations
@Override
getEntryNamesback to summary
public Set<String> getEntryNames()

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getEntryNames.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.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)

Annotations
@Override
getNameback to summary
public String getName()

Implements org.apache.poi.poifs.filesystem.Entry.getName.

Doc from org.apache.poi.poifs.filesystem.Entry.getName.

get the name of the Entry

Returns:String

name

Annotations
@Override
getParentback to summary
public DirectoryEntry getParent()

Implements org.apache.poi.poifs.filesystem.Entry.getParent.

Doc from org.apache.poi.poifs.filesystem.Entry.getParent.

get this Entry's parent (the DirectoryEntry that owns this Entry). All Entry objects, except the root Entry, has a parent.

Returns:DirectoryEntry

this Entry's parent; null iff this is the root Entry

Annotations
@Override
getStorageClsidback to summary
public ClassID getStorageClsid()

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.getStorageClsid.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.getStorageClsid.

Gets the storage clsid of the directory entry

Returns:ClassID

storage Class ID

Annotations
@Override
hasEntryback to summary
public boolean hasEntry(String name)

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.hasEntry.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.hasEntry.

Checks if entry with specified name present, case sensitive

Annotations
@Override
hasEntryCaseInsensitiveback to summary
public boolean hasEntryCaseInsensitive(String name)

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.hasEntryCaseInsensitive.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.hasEntryCaseInsensitive.

Checks if entry with specified name present, case sensitive

Annotations
@Override
isDirectoryEntryback to summary
public boolean isDirectoryEntry()

Implements org.apache.poi.poifs.filesystem.Entry.isDirectoryEntry.

Doc from org.apache.poi.poifs.filesystem.Entry.isDirectoryEntry.

is this a DirectoryEntry?

Returns:boolean

true if the Entry is a DirectoryEntry, else false

Annotations
@Override
isDocumentEntryback to summary
public boolean isDocumentEntry()

Implements org.apache.poi.poifs.filesystem.Entry.isDocumentEntry.

Doc from org.apache.poi.poifs.filesystem.Entry.isDocumentEntry.

is this a DocumentEntry?

Returns:boolean

true if the Entry is a DocumentEntry, else false

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.isEmpty.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.isEmpty.

is this DirectoryEntry empty?

Returns:boolean

true if this instance contains no Entry instances

Annotations
@Override
iteratorback to summary
public Iterator<Entry> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<Entry>

an Iterator.

Annotations
@Override
renameToback to summary
public boolean renameTo(String newName)

Implements org.apache.poi.poifs.filesystem.Entry.renameTo.

Doc from org.apache.poi.poifs.filesystem.Entry.renameTo.

Rename this Entry. This operation will fail if: There is a sibling Entry (i.e., an Entry whose parent is the same as this Entry's parent) with the same name. This Entry is the root of the Entry tree. Its name is dictated by the Filesystem and many not be changed.

Parameters
newName:String

the new name for this Entry

Returns:boolean

true if the operation succeeded, else false

Annotations
@Override
setStorageClsidback to summary
public void setStorageClsid(ClassID clsidStorage)

Implements org.apache.poi.poifs.filesystem.DirectoryEntry.setStorageClsid.

Doc from org.apache.poi.poifs.filesystem.DirectoryEntry.setStorageClsid.

Sets the storage clsid for the directory entry

Parameters
clsidStorage:ClassID

storage Class ID

Annotations
@Override
spliteratorback to summary
public Spliterator<Entry> spliterator()

Overrides default java.lang.Iterable.spliterator.

Doc from java.lang.Iterable.spliterator.

Creates a Spliterator over the elements described by this Iterable.

Returns:Spliterator<Entry>

a Spliterator over the elements described by this Iterable.

Annotations
@Override
Since
POI 5.2.0
wrapEntryback to summary
private Entry wrapEntry(Entry entry)
org.apache.poi.poifs.filesystem back to summary

private Class FilteringDirectoryNode.FilteringIterator

extends Object
implements Iterator<Entry>
Class Inheritance
  • java.lang.Object
  • org.apache.poi.poifs.filesystem.FilteringDirectoryNode.FilteringIterator
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private Entry
private final Iterator<Entry>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

private void
public Entry
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nextback to summary
private Entry next
parentback to summary
private final Iterator<Entry> parent

Constructor Detail

FilteringIteratorback to summary
private FilteringIterator()

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
locateNextback to summary
private void locateNext()
nextback to summary
public Entry next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Entry

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override