Class PDFXRefStream


  • public class PDFXRefStream
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      PDFXRefStream​(COSDocument cosDocument)
      Create a fresh XRef stream like for a fresh file or an incremental update.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addEntry​(XReferenceEntry entry)
      Add an new entry to the XRef stream.
      void addTrailerInfo​(COSDictionary trailerDict)
      Copy all Trailer Information to this file.
      private java.util.List<java.lang.Long> getIndexEntry()  
      COSStream getStream()
      Returns the stream of the XRef.
      private int[] getWEntry()
      determines the minimal length required for all the lengths.
      void setSize​(long streamSize)
      Set the size of the XRef stream.
      private void writeNumber​(java.io.OutputStream os, long number, int bytes)  
      private void writeStreamData​(java.io.OutputStream os, int[] w)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • objectNumbers

        private final java.util.Set<java.lang.Long> objectNumbers
      • size

        private long size
    • Constructor Detail

      • 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 Detail

      • getStream

        public COSStream getStream()
                            throws java.io.IOException
        Returns the stream of the XRef.
        Returns:
        the XRef stream
        Throws:
        java.io.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 java.util.List<java.lang.Long> getIndexEntry()
      • writeNumber

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

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