Package com.itextpdf.kernel.di.pagetree
Class DefaultPageTreeListFactory
- java.lang.Object
-
- com.itextpdf.kernel.di.pagetree.DefaultPageTreeListFactory
-
- All Implemented Interfaces:
IPageTreeListFactory
public class DefaultPageTreeListFactory extends java.lang.Object implements IPageTreeListFactory
This class is a default implementation ofIPageTreeListFactory
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.
-
-
Field Summary
Fields Modifier and Type Field Description private int
maxEntriesBeforeSwitchingToNullUnlimitedList
-
Constructor Summary
Constructors Constructor Description DefaultPageTreeListFactory(int maxEntriesBeforeSwitchingToNullUnlimitedList)
Creates a new instance of DefaultPageTreeListFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> ISimpleList<T>
createList(PdfDictionary pagesDictionary)
Creates a list based on the count value in the pages dictionary.
-
-
-
Constructor Detail
-
DefaultPageTreeListFactory
public DefaultPageTreeListFactory(int maxEntriesBeforeSwitchingToNullUnlimitedList)
Creates a new instance of DefaultPageTreeListFactory.- Parameters:
maxEntriesBeforeSwitchingToNullUnlimitedList
- the maximum number of entries before switching to a NullUnlimitedList.
-
-
Method Detail
-
createList
public <T> ISimpleList<T> createList(PdfDictionary pagesDictionary)
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
-
-