Package loci.poi.poifs.filesystem
Class POIFSDocumentPath
java.lang.Object
loci.poi.poifs.filesystem.POIFSDocumentPath
Class POIFSDocumentPath
- Version:
- %I%, %G%
- Author:
- Marc Johnson (mjohnson at apache dot org)
-
Constructor Summary
ConstructorsConstructorDescriptionsimple constructor for the path of a document that is in the root of the POIFSFileSystem.POIFSDocumentPath(String[] components) constructor for the path of a document that is not in the root of the POIFSFileSystemPOIFSDocumentPath(POIFSDocumentPath path, String[] components) constructor that adds additional subdirectories to an existing path -
Method Summary
Modifier and TypeMethodDescriptionbooleanequality.getComponent(int n) get the specified componentReturns the path's parent ornullif this path is the root path.inthashCode()calculate and return the hashcodeintlength()toString()Returns a string representation of the path.
-
Constructor Details
-
POIFSDocumentPath
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:
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, String[] components) throws IllegalArgumentException constructor that adds additional subdirectories to an existing path- Parameters:
path- the existing pathcomponents- the additional subdirectory names to be added- Throws:
IllegalArgumentException- if any of the Strings in components is null or zero length
-
-
Method Details
-
equals
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 -
hashCode
public int hashCode()calculate and return the hashcode -
length
public int length()- Returns:
- the number of components
-
getComponent
get the specified component- Parameters:
n- which component (0 ... length() - 1)- Returns:
- the nth component;
- Throws:
ArrayIndexOutOfBoundsException- if n < 0 or n >= length()
-
getParent
Returns the path's parent or
nullif this path is the root path.- Returns:
- path of parent, or null if this path is the root path
- Since:
- 2002-01-24
-
toString
Returns a string representation of the path. Components are separated by the platform-specific file separator.
-