Package com.itextpdf.kernel.di.pagetree
Class DefaultPageTreeListFactory
java.lang.Object
com.itextpdf.kernel.di.pagetree.DefaultPageTreeListFactory
- All Implemented Interfaces:
-
IPageTreeListFactory
This class is a default implementation of
IPageTreeListFactory
that is used as a default.
This class will create an arraylist when in creation mode. In reading and editing mode, it will create a NullUnlimitedList if the count is greater than the maxEntriesBeforeSwitchingToNullUnlimitedList. This is to prevent potential OOM exceptions when loading a document with a large number of pages where only a few pages are needed.
-
Constructor Summary
ConstructorDescriptionDefaultPageTreeListFactory
(int maxEntriesBeforeSwitchingToNullUnlimitedList) Creates a new instance of DefaultPageTreeListFactory. -
Method Summary
Modifier and TypeMethodDescriptioncreateList
(PdfDictionary pagesDictionary) Creates a list based on the count value in the pages dictionary.
-
Constructor Details
-
DefaultPageTreeListFactory
public DefaultPageTreeListFactory(int maxEntriesBeforeSwitchingToNullUnlimitedList) Creates a new instance of DefaultPageTreeListFactory.- Parameters:
-
maxEntriesBeforeSwitchingToNullUnlimitedList
- the maximum number of entries before switching to a NullUnlimitedList.
-
-
Method Details
-
createList
Creates a list based on the count value in the pages dictionary. If the count value is greater than the maxEntriesBeforeSwitchingToNullUnlimitedList, a NullUnlimitedList is created. This is to optimize memory usage when loading a document with a large number of pages where only a few pages are needed.- Specified by:
-
createList
in interfaceIPageTreeListFactory
- Type Parameters:
-
T
- The type of the list - Parameters:
-
pagesDictionary
- The pages dictionary - Returns:
- The list
-