Class DefaultPageTreeListFactory

java.lang.Object
com.itextpdf.kernel.di.pagetree.DefaultPageTreeListFactory
All Implemented Interfaces:
IPageTreeListFactory

public class DefaultPageTreeListFactory extends Object implements 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 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

      public  ISimpleList 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 interface IPageTreeListFactory
      Type Parameters:
      T - The type of the list
      Parameters:
      pagesDictionary - The pages dictionary
      Returns:
      The list