Package org.pdfclown.objects

Examples of org.pdfclown.objects.PdfIndirectObject


  @Override
  public PdfIndirectObject get(
    int index
    )
  {
    PdfIndirectObject object = modifiedObjects.get(index);
    if(object == null)
    {
      object = wokenObjects.get(index);
      if(object == null)
      {
        XRefEntry xrefEntry = xrefEntries.get(index);
        if(xrefEntry == null)
        {
          if(index > lastObjectNumber)
            return null;

          /*
            NOTE: The cross-reference table (comprising the original cross-reference section and all update sections)
            MUST contain one entry for each object number from 0 to the maximum object number used in the file, even
            if one or more of the object numbers in this range do not actually occur in the file.
            However, for resilience purposes missing entries are treated as free ones.
          */
          xrefEntries.put(
            index,
            xrefEntry = new XRefEntry(
              index,
              XRefEntry.GenerationUnreusable,
              0,
              XRefEntry.UsageEnum.Free
              )
            );
        }

        // Awake the object!
        /*
          NOTE: This operation allows to keep a consistent state across the whole session,
          avoiding multiple incoherent instantiations of the same original indirect object.
        */
        wokenObjects.put(index, object = new PdfIndirectObject(file, null, xrefEntry));

        // Early registration?
        if(updateMode == UpdateModeEnum.Automatic)
        {update(object);}
      }
View Full Code Here


      According to such an implementation note, we simply mark the removed object as 'not-reusable'
      newly-freed entry, neglecting both to add it to the linked list of free entries
      and to increment by 1 its generation number.
    */
    return update(
      new PdfIndirectObject(
        file,
        null,
        new XRefEntry(
          index,
          XRefEntry.GenerationUnreusable,
View Full Code Here

    )
  {
    int index = object.getReference().getObjectNumber();

    // Get the old indirect object to be replaced!
    PdfIndirectObject old = get(index);
    if(old != object)
    {old.dropFile();} // Disconnects the old indirect object.

    // Insert the new indirect object into the modified objects collection!
    modifiedObjects.put(index,object);
    // Remove old indirect object from cache!
    wokenObjects.remove(index);
View Full Code Here

TOP

Related Classes of org.pdfclown.objects.PdfIndirectObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.