Package org.apache.poi.openxml4j.opc
Class PackagePartCollection
- java.lang.Object
-
- org.apache.poi.openxml4j.opc.PackagePartCollection
-
- All Implemented Interfaces:
java.io.Serializable
public final class PackagePartCollection extends java.lang.Object implements java.io.SerializableA package part collection.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PackagePartCollection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(PackagePartName partName)PackagePartget(PackagePartName partName)intgetUnusedPartIndex(java.lang.String nameTemplate)Get an unused part index based on the namePattern, which doesn't exist yet and has the lowest positive indexPackagePartput(PackagePartName partName, PackagePart part)Check rule [M1.11]: a package implementer shall neither create nor recognize a part with a part name derived from another part name by appending segments to it.PackagePartremove(PackagePartName key)intsize()java.util.Collection<PackagePart>sortedValues()The values themselves should be returned in sorted order.
-
-
-
Method Detail
-
put
public PackagePart put(PackagePartName partName, PackagePart part)
Check rule [M1.11]: a package implementer shall neither create nor recognize a part with a part name derived from another part name by appending segments to it.- Parameters:
partName- name of partpart- part to put- Returns:
- the previous value associated with
partName, ornullif there was no mapping forpartName. - Throws:
InvalidOperationException- Throws if you try to add a part with a name derived from another part name.
-
remove
public PackagePart remove(PackagePartName key)
-
sortedValues
public java.util.Collection<PackagePart> sortedValues()
The values themselves should be returned in sorted order. Doing it here avoids paying the high cost of Natural Ordering per insertion.- Returns:
- unmodifiable collection of parts
-
containsKey
public boolean containsKey(PackagePartName partName)
-
get
public PackagePart get(PackagePartName partName)
-
size
public int size()
-
getUnusedPartIndex
public int getUnusedPartIndex(java.lang.String nameTemplate) throws InvalidFormatExceptionGet an unused part index based on the namePattern, which doesn't exist yet and has the lowest positive index- Parameters:
nameTemplate- The template for new part names containing a'#'for the index, e.g. "/ppt/slides/slide#.xml"- Returns:
- the next available part name index
- Throws:
InvalidFormatException- if the nameTemplate is null or doesn't contain the index char (#) or results in an invalid part name
-
-