Package org.apache.poi.poifs.filesystem
Class POIFSDocumentPath
- java.lang.Object
-
- org.apache.poi.poifs.filesystem.POIFSDocumentPath
-
public class POIFSDocumentPath extends java.lang.Object
Class POIFSDocumentPath
-
-
Constructor Summary
Constructors Constructor Description POIFSDocumentPath()
simple constructor for the path of a document that is in the root of the POIFSFileSystem.POIFSDocumentPath(java.lang.String[] components)
constructor for the path of a document that is not in the root of the POIFSFileSystemPOIFSDocumentPath(POIFSDocumentPath path, java.lang.String[] components)
constructor that adds additional subdirectories to an existing path
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
equality.java.lang.String
getComponent(int n)
get the specified componentjava.lang.String
getName()
Returns the last name in the document path's name sequence.POIFSDocumentPath
getParent()
Returns the path's parent ornull
if this path is the root path.int
hashCode()
calculate and return the hashcodeint
length()
java.lang.String
toString()
Returns a string representation of the path.
-
-
-
Constructor Detail
-
POIFSDocumentPath
public POIFSDocumentPath(java.lang.String[] components) throws java.lang.IllegalArgumentException
constructor for the path of a document that is not in the root of the POIFSFileSystem- Parameters:
components
- the Strings making up the path to a document. The Strings must be ordered as they appear in the directory hierarchy of the 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
- Throws:
java.lang.IllegalArgumentException
- if any of the elements in the components parameter are null or have zero length
-
POIFSDocumentPath
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
-
POIFSDocumentPath
public POIFSDocumentPath(POIFSDocumentPath path, java.lang.String[] components) throws java.lang.IllegalArgumentException
constructor that adds additional subdirectories to an existing path- Parameters:
path
- the existing pathcomponents
- the additional subdirectory names to be added- Throws:
java.lang.IllegalArgumentException
- if any of the Strings in components is null or zero length
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
equality. Two POIFSDocumentPath instances are equal if they have the same number of component Strings, and if each component String is equal to its coresponding component String- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- the object we're checking equality for- Returns:
- true if the object is equal to this object
-
hashCode
public int hashCode()
calculate and return the hashcode- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashcode
-
length
public int length()
- Returns:
- the number of components
-
getComponent
public java.lang.String getComponent(int n) throws java.lang.ArrayIndexOutOfBoundsException
get the specified component- Parameters:
n
- which component (0 ... length() - 1)- Returns:
- the nth component;
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- if n < 0 or n >= length()
-
getParent
public POIFSDocumentPath getParent()
Returns the path's parent or
null
if this path is the root path.- Returns:
- path of parent, or null if this path is the root path
- Since:
- 2002-01-24
-
getName
public java.lang.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:
- The last name in the document path's name sequence, or empty string if this is the root path
- Since:
- 2016-04-09
-
toString
public java.lang.String toString()
Returns a string representation of the path. Components are separated by the platform-specific file separator
File.separatorChar
- Overrides:
toString
in classjava.lang.Object
- Returns:
- string representation
- Since:
- 2002-01-24
-
-