Class PDFXRefStream

java.lang.Object
org.apache.pdfbox.pdfparser.PDFXRefStream

public class PDFXRefStream extends Object
  • Field Details

    • streamData

      private final List<XReferenceEntry> streamData
    • objectNumbers

      private final Set<Long> objectNumbers
    • stream

      private final COSStream stream
    • size

      private long size
  • Constructor Details

    • PDFXRefStream

      public PDFXRefStream(COSDocument cosDocument)
      Create a fresh XRef stream like for a fresh file or an incremental update.
      Parameters:
      cosDocument - the COSDocmernt to be used to create a new COSStream
  • Method Details

    • getStream

      public COSStream getStream() throws IOException
      Returns the stream of the XRef.
      Returns:
      the XRef stream
      Throws:
      IOException - if something went wrong
    • addTrailerInfo

      public void addTrailerInfo(COSDictionary trailerDict)
      Copy all Trailer Information to this file.
      Parameters:
      trailerDict - dictionary to be added as trailer info
    • addEntry

      public void addEntry(XReferenceEntry entry)
      Add an new entry to the XRef stream.
      Parameters:
      entry - new entry to be added
    • getWEntry

      private int[] getWEntry()
      determines the minimal length required for all the lengths.
      Returns:
      the length information
    • setSize

      public void setSize(long streamSize)
      Set the size of the XRef stream.
      Parameters:
      streamSize - size to bet set as stream size
    • getIndexEntry

      private List<Long> getIndexEntry()
    • writeNumber

      private void writeNumber(OutputStream os, long number, int bytes) throws IOException
      Throws:
      IOException
    • writeStreamData

      private void writeStreamData(OutputStream os, int[] w) throws IOException
      Throws:
      IOException