Package org.apache.poi.openxml4j.opc
Class PackagePartName
- java.lang.Object
-
- org.apache.poi.openxml4j.opc.PackagePartName
-
- All Implemented Interfaces:
java.lang.Comparable<PackagePartName>
public final class PackagePartName extends java.lang.Object implements java.lang.Comparable<PackagePartName>
An immutable Open Packaging Convention compliant part name.- See Also:
- http://www.ietf.org/rfc/rfc3986.txt
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intcompare(java.lang.String str1, java.lang.String str2)A natural sort order for strings, consistent with the requirements ofjava.util.Comparator, but simply implemented as a static method.static intcompare(PackagePartName obj1, PackagePartName obj2)A natural sort order for package part names, consistent with the requirements ofjava.util.Comparator, but simply implemented as a static method.intcompareTo(PackagePartName other)Compare two part names following the rule M1.12 : Part name equivalence is determined by comparing part names as case-insensitive ASCII strings.booleanequals(java.lang.Object other)Part name equivalence is determined by comparing part names as case-insensitive ASCII strings.java.lang.StringgetExtension()Retrieves the extension of the part name if any.java.lang.StringgetName()Get this part name.java.net.URIgetURI()Part name property getter.inthashCode()booleanisRelationshipPartURI()Know if this part name is a relationship part name.java.lang.StringtoString()
-
-
-
Method Detail
-
isRelationshipPartURI
public boolean isRelationshipPartURI()
Know if this part name is a relationship part name.- Returns:
trueif this part name respect the relationship part naming convention elsefalse.
-
compareTo
public int compareTo(PackagePartName other)
Compare two part names following the rule M1.12 : Part name equivalence is determined by comparing part names as case-insensitive ASCII strings. Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names. [M1.12]- Specified by:
compareToin interfacejava.lang.Comparable<PackagePartName>
-
getExtension
public java.lang.String getExtension()
Retrieves the extension of the part name if any. If there is no extension returns an empty String. Example : '/document/content.xml' => 'xml'- Returns:
- The extension of the part name.
-
getName
public java.lang.String getName()
Get this part name.- Returns:
- The name of this part name.
-
equals
public boolean equals(java.lang.Object other)
Part name equivalence is determined by comparing part names as case-insensitive ASCII strings. Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names. [M1.12]- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getURI
public java.net.URI getURI()
Part name property getter.- Returns:
- This part name URI.
-
compare
public static int compare(PackagePartName obj1, PackagePartName obj2)
A natural sort order for package part names, consistent with the requirements ofjava.util.Comparator, but simply implemented as a static method.For example, this sorts "file10.png" after "file2.png" (comparing the numerical portion), but sorts "File10.png" before "file2.png" (lexigraphical sort)
When comparing part names, the rule M1.12 is followed: Part name equivalence is determined by comparing part names as case-insensitive ASCII strings. Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names. [M1.12]
- Parameters:
obj1- firstPackagePartNameto compareobj2- secondPackagePartNameto compare- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
-
compare
public static int compare(java.lang.String str1, java.lang.String str2)A natural sort order for strings, consistent with the requirements ofjava.util.Comparator, but simply implemented as a static method.For example, this sorts "file10.png" after "file2.png" (comparing the numerical portion), but sorts "File10.png" before "file2.png" (lexigraphical sort)
- Parameters:
str1- first string to comparestr1- second string to compare- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
-
-