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

public Class POIFSDocumentPath

extends Object
Class Inheritance
Imports
java.io.File, java.util.Arrays, .Objects, java.util.function.Predicate, java.util.stream.Stream

Class POIFSDocumentPath

Field Summary

Modifier and TypeField and Description
private final String[]
private int

Constructor Summary

AccessConstructor and Description
public
POIFSDocumentPath()

simple constructor for the path of a document that is in the root of the POIFSFileSystem.

public
POIFSDocumentPath(final String[]
the Strings making up the path to a document. The Strings must be ordered as they appear in the directory hierarchy of the document. The first string must be the name of a directory in the root of the POIFSFileSystem, and every Nth (for N > 1) string thereafter must be the name of a directory in the directory identified by the (N-1)th string.

If the components parameter is null or has zero length, the POIFSDocumentPath is appropriate for a document that is in the root of a POIFSFileSystem

components
)

constructor for the path of a document that is not in the root of the POIFSFileSystem

public
POIFSDocumentPath(final POIFSDocumentPath
the existing path
path
,
final String[]
the additional subdirectory names to be added
components
)

constructor that adds additional subdirectories to an existing path

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the object is equal to this object
equals
(final Object
the object we're checking equality for
o
)

Overrides java.lang.Object.equals.

Two POIFSDocumentPath instances are equal if they have the same number of component Strings, and if each component String is equal to its corresponding component String

public String

Returns:

the nth component;
getComponent
(int
which component (0 ... length() - 1)
n
)

get the specified component

public String

Returns:

The last name in the document path's name sequence, or empty string if this is the root path
getName
()

Returns the last name in the document path's name sequence.

public POIFSDocumentPath

Returns:

path of parent, or null if this path is the root path
getParent
()

Returns the path's parent or null if this path is the root path.

public int

Returns:

hashcode
hashCode
()

Overrides java.lang.Object.hashCode.

calculate and return the hashcode

public int

Returns:

the number of components
length
()

public String

Returns:

string representation
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of the path.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

componentsback to summary
private final String[] components
hashcodeback to summary
private int hashcode

Constructor Detail

POIFSDocumentPathback to summary
public POIFSDocumentPath()

simple constructor for the path of a document that is in the root of the POIFSFileSystem. The constructor that takes an array of Strings can also be used to create such a POIFSDocumentPath by passing it a null or empty String array

POIFSDocumentPathback to summary
public POIFSDocumentPath(final String[] components) throws IllegalArgumentException

constructor for the path of a document that is not in the root of the POIFSFileSystem

Parameters
components:String[]

the Strings making up the path to a document. The Strings must be ordered as they appear in the directory hierarchy of the document. The first string must be the name of a directory in the root of the POIFSFileSystem, and every Nth (for N > 1) string thereafter must be the name of a directory in the directory identified by the (N-1)th string.

If the components parameter is null or has zero length, the POIFSDocumentPath is appropriate for a document that is in the root of a POIFSFileSystem

Exceptions
IllegalArgumentException:
if any of the elements in the components parameter are null or have zero length
POIFSDocumentPathback to summary
public POIFSDocumentPath(final POIFSDocumentPath path, final String[] components) throws IllegalArgumentException

constructor that adds additional subdirectories to an existing path

Parameters
path:POIFSDocumentPath

the existing path

components:String[]

the additional subdirectory names to be added

Exceptions
IllegalArgumentException:
if any of the Strings in components is null or zero length

Method Detail

equalsback to summary
public boolean equals(final Object o)

Overrides java.lang.Object.equals.

Two POIFSDocumentPath instances are equal if they have the same number of component Strings, and if each component String is equal to its corresponding component String

Parameters
o:Object

the object we're checking equality for

Returns:boolean

true if the object is equal to this object

getComponentback to summary
public String getComponent(int n) throws ArrayIndexOutOfBoundsException

get the specified component

Parameters
n:int

which component (0 ... length() - 1)

Returns:String

the nth component;

Exceptions
ArrayIndexOutOfBoundsException:
if n < 0 or n >= length()
getNameback to summary
public String getName()

Returns the last name in the document path's name sequence. If the document path's name sequence is empty, then the empty string is returned.

Returns:String

The last name in the document path's name sequence, or empty string if this is the root path

Since
2016-04-09
getParentback to summary
public POIFSDocumentPath getParent()

Returns the path's parent or null if this path is the root path.

Returns:POIFSDocumentPath

path of parent, or null if this path is the root path

Since
2002-01-24
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

calculate and return the hashcode

Returns:int

hashcode

lengthback to summary
public int length()
Returns:int

the number of components

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of the path. Components are separated by the platform-specific file separator File#separatorChar

Returns:String

string representation

Since
2002-01-24