PDF Clown
0.1.2

org.pdfclown.files
Class IndirectObjects

java.lang.Object
  extended by org.pdfclown.files.IndirectObjects
All Implemented Interfaces:
Iterable<PdfIndirectObject>, Collection<PdfIndirectObject>, List<PdfIndirectObject>

public final class IndirectObjects
extends Object
implements List<PdfIndirectObject>

Collection of the alive indirect objects available inside the file.

According to the PDF spec, indirect object entries may be free (no data object associated) or in-use (data object associated).

We can effectively subdivide indirect objects in two possibly-overriding collections: the original indirect objects (coming from the associated preexisting file) and the newly-registered indirect objects (coming from new data objects or original indirect objects manipulated during the current session).

To ensure that the modifications applied to an original indirect object are committed to being persistent is critical that the modified original indirect object is newly-registered (practically overriding the original indirect object).

Alive indirect objects encompass all the newly-registered ones plus not-overridden original ones.

Since:
0.0.0
Version:
0.1.2, 12/21/12
Author:
Stefano Chizzolini (http://www.stefanochizzolini.it)

Method Summary
 void add(int index, PdfIndirectObject object)
           
 PdfIndirectObject add(PdfDataObject object)
          Registers an internal data object.
 boolean add(PdfIndirectObject object)
          Registers an external indirect object.
 boolean addAll(Collection<? extends PdfIndirectObject> objects)
          Registers a collection of external indirect objects.
 boolean addAll(int index, Collection<? extends PdfIndirectObject> objects)
           
 Collection<? extends PdfIndirectObject> addExternal(Collection<? extends PdfIndirectObject> objects)
          Registers a collection of external indirect objects.
 PdfIndirectObject addExternal(PdfIndirectObject object)
          Registers an external indirect object.
 PdfIndirectObject addExternal(PdfIndirectObject object, Cloner cloner)
          Registers an external indirect object.
 PdfIndirectObject addVirtual(PdfIndirectObject object)
          For internal use only.
 void clear()
           
 boolean contains(Object object)
           
 boolean containsAll(Collection<?> objects)
           
 boolean equals(Object object)
           
 PdfIndirectObject get(int index)
           
 File getFile()
          Gets the file associated to this collection.
 TreeMap<Integer,PdfIndirectObject> getModifiedObjects()
          For internal use only.
 int hashCode()
           
 int indexOf(Object object)
           
 boolean isEmpty()
           
 Iterator<PdfIndirectObject> iterator()
           
 int lastIndexOf(Object object)
           
 ListIterator<PdfIndirectObject> listIterator()
           
 ListIterator<PdfIndirectObject> listIterator(int index)
           
 PdfIndirectObject remove(int index)
           
 boolean remove(Object object)
           
 boolean removeAll(Collection<?> objects)
           
 boolean retainAll(Collection<?> objects)
           
 PdfIndirectObject set(int index, PdfIndirectObject object)
           
 int size()
          Gets the number of entries available (both in-use and free) in the collection.
 List<PdfIndirectObject> subList(int fromIndex, int toIndex)
           
 PdfIndirectObject[] toArray()
           
<T> T[]
toArray(T[] objects)
           
 PdfIndirectObject update(PdfIndirectObject object)
          For internal use only.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

add

public PdfIndirectObject add(PdfDataObject object)
Registers an internal data object.

To register an external indirect object, use addExternal(PdfIndirectObject).

Returns:
Indirect object corresponding to the registered data object.

addExternal

public PdfIndirectObject addExternal(PdfIndirectObject object)
Registers an external indirect object.

External indirect objects come from alien PDF files; therefore, this is a powerful way to import contents from a file into another one.

To register an internal data object, use add(PdfDataObject).

Parameters:
object - External indirect object to import.
Returns:
Indirect object imported from the external indirect object.

addExternal

public PdfIndirectObject addExternal(PdfIndirectObject object,
                                     Cloner cloner)
Registers an external indirect object.

External indirect objects come from alien PDF files; therefore, this is a powerful way to import contents from a file into another one.

To register an internal data object, use add(PdfDataObject).

Parameters:
object - External indirect object to import.
cloner - Import rules.
Returns:
Indirect object imported from the external indirect object.

addExternal

public Collection<? extends PdfIndirectObject> addExternal(Collection<? extends PdfIndirectObject> objects)
Registers a collection of external indirect objects.

External indirect objects come from alien PDF files; therefore, this is a powerful way to import contents from a file into another one.

To register a collection of internal data objects, use #addAll(Collection).

Returns:
Indirect objects imported from the external indirect objects.

getFile

public File getFile()
Gets the file associated to this collection.


add

public void add(int index,
                PdfIndirectObject object)
Specified by:
add in interface List<PdfIndirectObject>

addAll

public boolean addAll(int index,
                      Collection<? extends PdfIndirectObject> objects)
Specified by:
addAll in interface List<PdfIndirectObject>

get

public PdfIndirectObject get(int index)
Specified by:
get in interface List<PdfIndirectObject>

indexOf

public int indexOf(Object object)
Specified by:
indexOf in interface List<PdfIndirectObject>

lastIndexOf

public int lastIndexOf(Object object)
Specified by:
lastIndexOf in interface List<PdfIndirectObject>

listIterator

public ListIterator<PdfIndirectObject> listIterator()
Specified by:
listIterator in interface List<PdfIndirectObject>

listIterator

public ListIterator<PdfIndirectObject> listIterator(int index)
Specified by:
listIterator in interface List<PdfIndirectObject>

remove

public PdfIndirectObject remove(int index)
Specified by:
remove in interface List<PdfIndirectObject>

set

public PdfIndirectObject set(int index,
                             PdfIndirectObject object)
Specified by:
set in interface List<PdfIndirectObject>

subList

public List<PdfIndirectObject> subList(int fromIndex,
                                       int toIndex)
Specified by:
subList in interface List<PdfIndirectObject>

add

public boolean add(PdfIndirectObject object)
Registers an external indirect object.

External indirect objects come from alien PDF files; therefore, this is a powerful way to import contents from a file into another one.

To register and get an external indirect object, use addExternal(PdfIndirectObject).

Specified by:
add in interface Collection<PdfIndirectObject>
Specified by:
add in interface List<PdfIndirectObject>
Returns:
Whether the indirect object was successfully registered.

addAll

public boolean addAll(Collection<? extends PdfIndirectObject> objects)
Registers a collection of external indirect objects.

External indirect objects come from alien PDF files; therefore, this is a powerful way to import contents from a file into another one.

To register and get external indirect objects, use addExternal(Collection).

Specified by:
addAll in interface Collection<PdfIndirectObject>
Specified by:
addAll in interface List<PdfIndirectObject>
Returns:
Whether this collection changed as a result of the call.

clear

public void clear()
Specified by:
clear in interface Collection<PdfIndirectObject>
Specified by:
clear in interface List<PdfIndirectObject>

contains

public boolean contains(Object object)
Specified by:
contains in interface Collection<PdfIndirectObject>
Specified by:
contains in interface List<PdfIndirectObject>

containsAll

public boolean containsAll(Collection<?> objects)
Specified by:
containsAll in interface Collection<PdfIndirectObject>
Specified by:
containsAll in interface List<PdfIndirectObject>

equals

public boolean equals(Object object)
Specified by:
equals in interface Collection<PdfIndirectObject>
Specified by:
equals in interface List<PdfIndirectObject>
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<PdfIndirectObject>
Specified by:
hashCode in interface List<PdfIndirectObject>
Overrides:
hashCode in class Object

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<PdfIndirectObject>
Specified by:
isEmpty in interface List<PdfIndirectObject>

remove

public boolean remove(Object object)
Specified by:
remove in interface Collection<PdfIndirectObject>
Specified by:
remove in interface List<PdfIndirectObject>

removeAll

public boolean removeAll(Collection<?> objects)
Specified by:
removeAll in interface Collection<PdfIndirectObject>
Specified by:
removeAll in interface List<PdfIndirectObject>

retainAll

public boolean retainAll(Collection<?> objects)
Specified by:
retainAll in interface Collection<PdfIndirectObject>
Specified by:
retainAll in interface List<PdfIndirectObject>

size

public int size()
Gets the number of entries available (both in-use and free) in the collection.

Specified by:
size in interface Collection<PdfIndirectObject>
Specified by:
size in interface List<PdfIndirectObject>
Returns:
The number of entries available in the collection.

toArray

public PdfIndirectObject[] toArray()
Specified by:
toArray in interface Collection<PdfIndirectObject>
Specified by:
toArray in interface List<PdfIndirectObject>

toArray

public <T> T[] toArray(T[] objects)
Specified by:
toArray in interface Collection<PdfIndirectObject>
Specified by:
toArray in interface List<PdfIndirectObject>

iterator

public Iterator<PdfIndirectObject> iterator()
Specified by:
iterator in interface Iterable<PdfIndirectObject>
Specified by:
iterator in interface Collection<PdfIndirectObject>
Specified by:
iterator in interface List<PdfIndirectObject>

addVirtual

public PdfIndirectObject addVirtual(PdfIndirectObject object)
For internal use only.


getModifiedObjects

public TreeMap<Integer,PdfIndirectObject> getModifiedObjects()
For internal use only.


update

public PdfIndirectObject update(PdfIndirectObject object)
For internal use only.


PDF Clown
0.1.2

Project home page

Copyright © 2006-2013 Stefano Chizzolini. Some Rights Reserved.
This documentation is available under the terms of the GNU Free Documentation License.