public class

Obj

extends Object
java.lang.Object
   ↳ com.pdftron.sdf.Obj

Class Overview

Obj is a concrete class for all SDF/Cos objects. Obj hierarchy implements the composite design pattern. As a result, you can invoke a member function of any 'derived' object through Obj interface. If the member function is not supported (e.g. if you invoke Obj::GetNumber() on a boolean object) an Exception will be thrown. You can use GetType() or obl.Is???() member functions to find out type-information at run time, however most of the time the type can be inferred from the PDF specification. Therefore when you call Doc::GetTrailer() you can assume that returned object is a dictionary. If there is any ambiguity use Is???() methods. Objects can't be shared across documents, however you can use Doc::ImportObj() to copy objects from one document to another. Objects can be shared within a document provided that they are created as indirect. Indirect objects are the ones that are referenced in cross-reference table. To create an object as indirect use Doc::CreateIndirect???() (where ? is the Object type).

Summary

Constants
int e_array The Constant e_array.
int e_bool The Constant e_bool.
int e_dict The Constant e_dict.
int e_name The Constant e_name.
int e_null The Constant e_null.
int e_number The Constant e_number.
int e_stream The Constant e_stream.
int e_string The Constant e_string.
Public Methods
static Obj __Create(long impl, Object ref)
long __GetHandle()
Object __GetRefHandle()
void erase(DictIterator pos)
Removes an element in the dictionary from specified position.
void erase(String key)
Removes an element in the dictionary that matches the given key.
void eraseAt(int pos)
Checks whether the position is within the array bounds and then removes it from the array and moves each subsequent element to the slot with the next smaller index and decrements the arrays length by 1.
DictIterator find(String key)
Search the dictionary for a given key.
Obj findObj(String key)
Search the dictionary for a given key.
DictIterator get(String key)
Search the dictionary for a given key and throw an exception if the key is not found.
String getAsPDFText()
Convert the SDF/Cos String object to 'PDF Text String' (a Unicode string).
Obj getAt(int index)
Get the Obj at specified index
boolean getBool()
Get the boolean value if Obj is bool
byte[] getBuffer()
Get string buffer

Note: if SDF/Cos String object is represented as 'PDF Text' (Section 3.8.1 'Text Strings' in PDF Reference) you can use GetAsPDFText method to obtain Unicode representation of the string.

Filter getDecodedStream()
Get the decoded stream.
DictIterator getDictIterator()
Get the dictionary iterator.
SDFDoc getDoc()
Get the Doc object contains this Obj

Note: this method can be invoked on any Obj.

short getGenNum()
Get the generation number.
String getName()
Get the string representation of the Name object
double getNumber()
Get the number value
long getObjNum()
Get the object number.
long getOffset()
Get the offset from beginning of the file.
byte[] getRawBuffer()
Get an array containg the encrypted string buffer.
Filter getRawStream(boolean decrypt)
Get the raw stream.
long getRawStreamLength()
Get the raw stream length.
int getType()
Get the Obj type.
Obj insert(int pos, Obj obj)
Inserts an existing Obj in this array.
Obj insertArray(int pos)
Inserts an Obj::Type::e_array object in the array.
Obj insertBool(int pos, boolean value)
Inserts an Obj::Type::e_bool object in the array.
Obj insertDict(int pos)
Inserts an Obj::Type::e_dict object in the array.
Obj insertMatrix(int pos, Matrix2D value)
Inserts an array of 6 numbers in this array.
Obj insertName(int pos, String name)
Inserts an Obj::Type::e_name object in the array.
Obj insertNull(int pos)
Inserts an Obj::Type::e_null object in the array.
Obj insertNumber(int pos, double value)
Inserts an Obj::Type::e_number object in the array.
Obj insertRect(int pos, double x1, double y1, double x2, double y2)
Inserts an array of 4 numbers in this array.
Obj insertRect(int pos, DoubleRectangle2D rect)
Inserts an array of 4 numbers in this array.
Obj insertString(int pos, String value)
Inserts an Obj::Type::e_string object in the array.
Obj insertString(int pos, byte[] value)
Inserts an Obj::Type::e_string object in the array.
Obj insertText(int pos, String value)
Inserts an Obj::Type::e_string object in the array.
boolean isArray()
Checks if Obj is an array.
boolean isBool()
Checks if Obj is Boolean object

Note: this method can be invoked on any Obj.

boolean isContainer()
Checks if Obj is a container object.
boolean isDict()
Checks if Obj is dictionary

Note: this method can be invoked on any Obj.

boolean isEqual(Obj to)
Checks if is equal to specified object
boolean isFree()
Checks if it is marked as free.
boolean isIndirect()
Checks if Obj is an indirect object

Note: this method can be invoked on any Obj.

boolean isLoaded()
Checks if Obj is loaded.
boolean isMarked()
Checks if Obj is marked.
boolean isName()
Checks if Obj is a name object.
boolean isNull()
Checks if is Obj null.
boolean isNumber()
Checks if Obj is Number object.
boolean isStream()
Checks if is a stream.
boolean isString()
Checks if Obj is a string object.
Obj pushBack(Obj obj)
Appends an existing Obj at the end of the array.
Obj pushBackArray()
Appends a new Obj::Type::e_array object at the end of the array.
Obj pushBackBool(boolean value)
Appends a new Obj::Type::e_bool object at the end of the array.
Obj pushBackDict()
Appends a new Obj::Type::e_dict object at the end of the array.
Obj pushBackMatrix(Matrix2D value)
Appends an array of 6 numbers at the end of the array.
Obj pushBackName(String name)
Appends a new Obj::Type::e_name object at the end of the array.
Obj pushBackNull()
Appends a new Obj::Type::e_null object at the end of the array.
Obj pushBackNumber(double value)
Appends a new Obj::Type::e_number object at the end of the array.
Obj pushBackRect(DoubleRectangle2D rect)
Appends an array of 4 numbers at the end of the array.
Obj pushBackRect(double x1, double y1, double x2, double y2)
Appends an array of 4 numbers at the end of the array.
Obj pushBackString(String value)
Appends a new Obj::Type::e_string object at the end of the array.
Obj pushBackString(byte[] value)
Appends a new Obj::Type::e_string object at the end of the array.
Obj pushBackText(String value)
Appends a new Obj::Type::e_string object at the end of the array.
Obj put(String key, Obj obj)
Inserts a <key, Obj> pair in the dictionary.
Obj putArray(String key)
Inserts a <key, Obj::Type::e_array> pair in the dictionary.
Obj putBool(String key, boolean value)
Inserts a <key, Obj::Type::e_bool> pair in the dictionary.
Obj putDict(String key)
Inserts a <key, Obj::Type::e_dict> pair in the dictionary.
Obj putMatrix(String key, Matrix2D value)
Inserts a <key, [a,b,c,d,h,v]> pair in the dictionary.
Obj putName(String key, String name)
Inserts a <key, Obj::Type::e_name> pair in the dictionary.
void putNull(String key)
Inserts a <key, Obj::Type::e_null> pair in the dictionary.
Obj putNumber(String key, double value)
Inserts a <key, Obj::Type::e_number> pair in the dictionary.
Obj putRect(String key, DoubleRectangle2D rect)
Inserts a <key, [x1,y1,x2,y2]> pair in the dictionary.
Obj putRect(String key, double x1, double y1, double x2, double y2)
Inserts a <key, [x1,y1,x2,y2]> pair in the dictionary.
Obj putString(String key, byte[] value)
Inserts a <key, Obj::Type::e_string> pair in the dictionary.
Obj putString(String key, String value)
Inserts a <key, Obj::Type::e_string> pair in the dictionary.
Obj putText(String key, String value)
Inserts a <key, Obj::Type::e_string> pair in the dictionary.
boolean rename(String old_key, String new_key)
Change the key value of a dictionary entry.
void setBool(boolean b)
Set the boolean value to Obj
void setMark(boolean mark)
Set the object mark.
void setName(String name)
Set the name string
void setNumber(double n)
Set the number value
void setStreamData(byte[] data, Filter filter_chain)
Update a stream object with the new content.
void setString(byte[] buf)
Set the string object value.
void setString(String value)
Set the string object value.
long size()
Get size of Obj

Note: this method can be invoked on any Obj.

void write(FilterWriter stream)
The function writes the Obj to the output stream.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int e_array

The Constant e_array.

Constant Value: 6 (0x00000006)

public static final int e_bool

The Constant e_bool.

Constant Value: 1 (0x00000001)

public static final int e_dict

The Constant e_dict.

Constant Value: 5 (0x00000005)

public static final int e_name

The Constant e_name.

Constant Value: 3 (0x00000003)

public static final int e_null

The Constant e_null.

Constant Value: 0 (0x00000000)

public static final int e_number

The Constant e_number.

Constant Value: 2 (0x00000002)

public static final int e_stream

The Constant e_stream.

Constant Value: 7 (0x00000007)

public static final int e_string

The Constant e_string.

Constant Value: 4 (0x00000004)

Public Methods

public static Obj __Create (long impl, Object ref)

public long __GetHandle ()

public Object __GetRefHandle ()

public void erase (DictIterator pos)

Removes an element in the dictionary from specified position.

Parameters
pos the pos

public void erase (String key)

Removes an element in the dictionary that matches the given key.

Parameters
key the key

public void eraseAt (int pos)

Checks whether the position is within the array bounds and then removes it from the array and moves each subsequent element to the slot with the next smaller index and decrements the arrays length by 1.

Parameters
pos the pos

public DictIterator find (String key)

Search the dictionary for a given key.

Note: A dictionary entry whose value is Obj::Null is equivalent to an absent entry. DictIterator itr = info_dict.find("Info"); if (itr.hasNext()) { Obj info = itr.value(); if (info.isDict()) info.putString("Producer", "PDFTron PDFNet SDK"); }

Parameters
key - a key to search for in the dictionary
Returns
  • The iterator to the matching key/value pair or invalid iterator (i.e. itr.hasNext()==fase) if the if the dictionary does not contain the given key.

public Obj findObj (String key)

Search the dictionary for a given key.

Note: A dictionary entry whose value is Obj::Null is equivalent to an absent entry.

Parameters
key - a key to search for in the dictionary
Returns
  • NULL if the dictionary does not contain the specified key. Otherwise return the corresponding value.

public DictIterator get (String key)

Search the dictionary for a given key and throw an exception if the key is not found.

Parameters
key - a key to search for in the dictionary
Returns
  • Obj::Null object if the value matching specified key is a Obj::Null object. otherwise return the interator to the matching key/value pair.

public String getAsPDFText ()

Convert the SDF/Cos String object to 'PDF Text String' (a Unicode string). PDF Text Strings are not used to represent page content, however they are used in text annotations, bookmark names, article names, document information etc. These strings are encoded in either PDFDocEncoding or Unicode character encoding. For more information on PDF Text Strings, please refer to section 3.8.1 'Text Strings' in PDF Reference.

Note: Not all SDF/Cos String objects are used to represent 'PDF Text'. PDF Reference indicates (on a case by case basis ) where an SDF/Cos String object can be used as 'PDF Text'.

Returns
  • the as pdf text

public Obj getAt (int index)

Get the Obj at specified index

Parameters
index - The array element to obtain. The first element in an array has an index of zero.
Returns
  • the at

public boolean getBool ()

Get the boolean value if Obj is bool

Returns
  • bool value if this is bool.

public byte[] getBuffer ()

Get string buffer

Note: if SDF/Cos String object is represented as 'PDF Text' (Section 3.8.1 'Text Strings' in PDF Reference) you can use GetAsPDFText method to obtain Unicode representation of the string.

use Size() member function in order to obtain the number of bytes in string buffer.

Returns
  • a pointer to the string buffer. Please note that the string may not be NULL terminated and that it may not be represented in ASCII or Unicode encoding. For more information on SDF/Cos String objects, please refer to section 3.2.3 'String Objects' in PDF Reference Manual.

public Filter getDecodedStream ()

Get the decoded stream.

Returns
  • - A filter to the decoded stream

public DictIterator getDictIterator ()

Get the dictionary iterator.

Returns
  • an iterator that addresses the first element in the dictionary.
Throws
PDFNetException DictIterator itr = dict.getDictIterator(); while (itr.hasNext()) { Obj key = itr.key(); Obj value = itr.value(); // ... itr.next() }

public SDFDoc getDoc ()

Get the Doc object contains this Obj

Note: this method can be invoked on any Obj.

Returns
  • the document to which this object belongs.

public short getGenNum ()

Get the generation number.

Note: this method can be invoked on any Obj.

Returns
  • generation number. If this is not an Indirect object, generation number of a containing indirect object is returned.

public String getName ()

Get the string representation of the Name object

Returns
  • string representation the Name object.

public double getNumber ()

Get the number value

Returns
  • value, if this is Number.

public long getObjNum ()

Get the object number.

Note: this method can be invoked on any Obj.

Returns
  • object number. If this is not an Indirect object, object number of a containing indirect object is returned.

public long getOffset ()

Get the offset from beginning of the file.

Note: this method can be invoked on any Obj.

Returns
  • object offset from the beginning of the file. If this is not an Indirect object, offset of a containing indirect object is returned.

public byte[] getRawBuffer ()

Get an array containg the encrypted string buffer.

Note: Similar in behaviour to GetBuffer except that no decryption is done. If the file is not encrypted the result should be the same as GetBuffer

Throws
PDFNetException Exception is thrown if this is not a Obj::Type::e_string.

public Filter getRawStream (boolean decrypt)

Get the raw stream.

Parameters
decrypt - If true decrypt the stream if the stream is encrypted.
Returns
  • - A filter to the encoded stream

public long getRawStreamLength ()

Get the raw stream length.

Returns
  • the length of the raw/encoded stream equal to the Lenght parameter

public int getType ()

Get the Obj type.

Note: this method can be invoked on any Obj.

Returns
  • the object type.

public Obj insert (int pos, Obj obj)

Inserts an existing Obj in this array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
obj The value to be inserted into the dictionary. If 'obj' is indirect (i.e. is a shared) object it will be inserted by reference, otherwise the object will be cloned and then inserted.
Returns
  • A newly inserted object.

public Obj insertArray (int pos)

Inserts an Obj::Type::e_array object in the array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
Returns
  • A newly created array object.

public Obj insertBool (int pos, boolean value)

Inserts an Obj::Type::e_bool object in the array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
value The value of the Obj::Type::e_bool object to be inserted.
Returns
  • A newly created boolean object.

public Obj insertDict (int pos)

Inserts an Obj::Type::e_dict object in the array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
Returns
  • A newly created dictionary object.

public Obj insertMatrix (int pos, Matrix2D value)

Inserts an array of 6 numbers in this array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
value - A matrix used to set the values in an array of six numbers. The resulting array will be then inserted in this array.
Returns
  • A newly created array object.

public Obj insertName (int pos, String name)

Inserts an Obj::Type::e_name object in the array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
name The value of the Obj::Type::e_name object to be inserted.
Returns
  • A newly created name object.

public Obj insertNull (int pos)

Inserts an Obj::Type::e_null object in the array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
Returns
  • A newly created null object.

public Obj insertNumber (int pos, double value)

Inserts an Obj::Type::e_number object in the array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
value The value of the Obj::Type::e_number object to be inserted.
Returns
  • A newly created number object.

public Obj insertRect (int pos, double x1, double y1, double x2, double y2)

Inserts an array of 4 numbers in this array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
x1 the x1
y1 the y1
x2 the x2
y2 the y2
Returns
  • A newly created array object.

public Obj insertRect (int pos, DoubleRectangle2D rect)

Inserts an array of 4 numbers in this array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.
rect - The value for an array of four numbers to be inserted in this array.
Returns
  • A newly created array object.

public Obj insertString (int pos, String value)

Inserts an Obj::Type::e_string object in the array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
value The value of the Obj::Type::e_string object to be inserted.
Returns
  • A newly created string object.

public Obj insertString (int pos, byte[] value)

Inserts an Obj::Type::e_string object in the array.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
value The buffer used to set the value of the Obj::Type::e_string object to be inserted.
Returns
  • A newly created string object.

public Obj insertText (int pos, String value)

Inserts an Obj::Type::e_string object in the array.

Note: InsertText will create the string object as a 'PDF Text' object.

Parameters
pos - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos <= Array-<Length(), appends obj to array.
value The value of the Obj::Type::e_string object to be inserted.
Returns
  • A newly created string object.

public boolean isArray ()

Checks if Obj is an array.

Note: this method can be invoked on any Obj.

Returns
  • true if this is an Array, false otherwise.

public boolean isBool ()

Checks if Obj is Boolean object

Note: this method can be invoked on any Obj.

Returns
  • true if this is a boolean object, false otherwise.

public boolean isContainer ()

Checks if Obj is a container object.

Note: this method can be invoked on any Obj.

Returns
  • true if this is a Container (a dictionary, array, or a stream), false otherwise.

public boolean isDict ()

Checks if Obj is dictionary

Note: this method can be invoked on any Obj.

Returns
  • true if this is a dictionary (i.e. Dict), false otherwise.

public boolean isEqual (Obj to)

Checks if is equal to specified object

Parameters
to the to
Returns
  • true if two Obj pointers point to the same object. This method does not compare object content so you should not use this method to compare two (e.g. Number) objects

public boolean isFree ()

Checks if it is marked as free.

Note: this method can be invoked on any Obj.

Returns
  • true if the object is in use or is marked as free.

public boolean isIndirect ()

Checks if Obj is an indirect object

Note: this method can be invoked on any Obj.

Returns
  • true if this is an Indirect object (i.e. object referenced in the cross-reference table), false otherwise.

public boolean isLoaded ()

Checks if Obj is loaded.

Note: this method can be invoked on any Obj.

Returns
  • true if the object is loaded in memory.

public boolean isMarked ()

Checks if Obj is marked.

Note: this method can be invoked on any Obj.

Returns
  • true if the object is marked.

public boolean isName ()

Checks if Obj is a name object.

Note: this method can be invoked on any Obj.

Returns
  • true if this is a Name object, false otherwise.

public boolean isNull ()

Checks if is Obj null.

Note: this method can be invoked on any Obj.

Returns
  • true if this is a Null object, false otherwise.

public boolean isNumber ()

Checks if Obj is Number object.

Note: this method can be invoked on any Obj.

Returns
  • true if this is a Number object, false otherwise.

public boolean isStream ()

Checks if is a stream.

Note: this method can be invoked on any Obj.

Returns
  • true if this is a Stream, false otherwise.

public boolean isString ()

Checks if Obj is a string object.

Note: this method can be invoked on any Obj.

Returns
  • true if this is a Str (String) object, false otherwise.

public Obj pushBack (Obj obj)

Appends an existing Obj at the end of the array.

Parameters
obj The value to be inserted into the dictionary. If 'obj' is indirect (i.e. is a shared) object it will be inserted by reference, otherwise the object will be cloned and then appended.
Returns
  • A newly appended object.

public Obj pushBackArray ()

Appends a new Obj::Type::e_array object at the end of the array.

Returns
  • The new array object.

public Obj pushBackBool (boolean value)

Appends a new Obj::Type::e_bool object at the end of the array.

Parameters
value the value
Returns
  • The new boolean object.

public Obj pushBackDict ()

Appends a new Obj::Type::e_dict object at the end of the array.

Returns
  • The new dictionary object.

public Obj pushBackMatrix (Matrix2D value)

Appends an array of 6 numbers at the end of the array.

Parameters
value - A matrix used to set the values in an array of six numbers. The resulting array will be then inserted in this array.
Returns
  • A newly appended array object.

public Obj pushBackName (String name)

Appends a new Obj::Type::e_name object at the end of the array.

Parameters
name - The value of the Obj::Type::e_name object.
Returns
  • The new array object.

public Obj pushBackNull ()

Appends a new Obj::Type::e_null object at the end of the array.

Returns
  • The new null object.

public Obj pushBackNumber (double value)

Appends a new Obj::Type::e_number object at the end of the array.

Parameters
value - The value of the Obj::Type::e_number object.
Returns
  • The new number object.

public Obj pushBackRect (DoubleRectangle2D rect)

Appends an array of 4 numbers at the end of the array.

Parameters
rect - The value for an array of four numbers to be appended.
Returns
  • A newly appended array object.

public Obj pushBackRect (double x1, double y1, double x2, double y2)

Appends an array of 4 numbers at the end of the array.

Parameters
x1 the x1
y1 the y1
x2 the x2
y2 the y2
Returns
  • A newly appended array object.

public Obj pushBackString (String value)

Appends a new Obj::Type::e_string object at the end of the array.

Parameters
value - The value of the Obj::Type::e_string object.
Returns
  • The new string object.

public Obj pushBackString (byte[] value)

Appends a new Obj::Type::e_string object at the end of the array.

Parameters
value The buffer used to set the value of the Obj::Type::e_string object to be inserted.
Returns
  • The new string object.

public Obj pushBackText (String value)

Appends a new Obj::Type::e_string object at the end of the array.

Note: InsertText will create the string object as a 'PDF Text' object.

Parameters
value The value of the Obj::Type::e_string object to be inserted.
Returns
  • The new string object.

public Obj put (String key, Obj obj)

Inserts a <key, Obj> pair in the dictionary.

Parameters
key The key of the value to set.
obj The value to be inserted into the dictionary. If 'obj' is indirect (i.e. is a shared) object it will be inserted by reference, otherwise the object will be cloned and then inserted into the dictionary.
Returns
  • A newly inserted object.

public Obj putArray (String key)

Inserts a <key, Obj::Type::e_array> pair in the dictionary.

Note: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

Parameters
key The key of the value to set.
Returns
  • A newly created array object.

public Obj putBool (String key, boolean value)

Inserts a <key, Obj::Type::e_bool> pair in the dictionary.

Note: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

Parameters
key The key of the value to set.
value The value of the Obj::Type::e_bool object to be inserted into the dictionary.
Returns
  • A newly created boolean object.

public Obj putDict (String key)

Inserts a <key, Obj::Type::e_dict> pair in the dictionary.

Note: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

Parameters
key The key of the value to set.
Returns
  • A newly created dictionary.

public Obj putMatrix (String key, Matrix2D value)

Inserts a <key, [a,b,c,d,h,v]> pair in the dictionary.

Note: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

Parameters
key The key of the value to set.
value - A matrix used to set the values in an array of six numbers. The resulting array will be inserted into the dictionary.
Returns
  • A newly created array object.

public Obj putName (String key, String name)

Inserts a <key, Obj::Type::e_name> pair in the dictionary.

Note: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

Parameters
key The key of the value to set.
name The value of the Obj::Type::e_name object to be inserted into the dictionary.
Returns
  • A newly created name object.

public void putNull (String key)

Inserts a <key, Obj::Type::e_null> pair in the dictionary.

Note: The effect of calling this method is essentially the same as dict.Erase(key) .

Parameters
key The key of the value to set.

public Obj putNumber (String key, double value)

Inserts a <key, Obj::Type::e_number> pair in the dictionary.

Note: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

Parameters
key The key of the value to set.
value The value of the Obj::Type::e_number object to be inserted into the dictionary.
Returns
  • A newly created number object.

public Obj putRect (String key, DoubleRectangle2D rect)

Inserts a <key, [x1,y1,x2,y2]> pair in the dictionary.

Note: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

Parameters
key The key of the value to set.
rect - The values for an array of four numbers to be inserted into the dictionary.
Returns
  • A newly created array object.

public Obj putRect (String key, double x1, double y1, double x2, double y2)

Inserts a <key, [x1,y1,x2,y2]> pair in the dictionary.

Note: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

Parameters
key The key of the value to set.
x1 the x1
y1 the y1
x2 the x2
y2 the y2
Returns
  • A newly created array object.

public Obj putString (String key, byte[] value)

Inserts a <key, Obj::Type::e_string> pair in the dictionary.

Note: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

Parameters
key The key of the value to set.
value The buffer used to set the value of the Obj::Type::e_string object to be inserted into the dictionary.
Returns
  • A newly created string object.

public Obj putString (String key, String value)

Inserts a <key, Obj::Type::e_string> pair in the dictionary.

Note: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

Parameters
key The key of the value to set.
value The value of the Obj::Type::e_string object to be inserted into the dictionary.
Returns
  • A newly created string object.

public Obj putText (String key, String value)

Inserts a <key, Obj::Type::e_string> pair in the dictionary.

Note: PutText will create the string object as a 'PDF Text' object.

If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

Parameters
key The key of the value to set.
value The value of the Obj::Type::e_string object to be inserted into the dictionary.
Returns
  • A newly created string object.

public boolean rename (String old_key, String new_key)

Change the key value of a dictionary entry. The key can't be renamed if another key with the same name already exists in the dictionary. In this case Rename returns false.

Parameters
old_key the old_key
new_key the new_key
Returns
  • true, if successful

public void setBool (boolean b)

Set the boolean value to Obj

Parameters
b - bool value used to set Bool object.

public void setMark (boolean mark)

Set the object mark. Mark is a boolean value that can be associated with every indirect object. This is especially useful when and object graph should be traversed and an operation should be performed on each node only once.

Note: this method can be invoked on any Obj.

Parameters
mark the new mark

public void setName (String name)

Set the name string

Parameters
name - value used to set Name object.

public void setNumber (double n)

Set the number value

Parameters
n - value used to set Number object.

public void setStreamData (byte[] data, Filter filter_chain)

Update a stream object with the new content.

Parameters
data the character array with the new content stream
filter_chain the filter_chain to be applied to the stream

public void setString (byte[] buf)

Set the string object value.

Parameters
buf the new string buffer

public void setString (String value)

Set the string object value.

Parameters
value the new string

public long size ()

Get size of Obj

Note: this method can be invoked on any Obj.

Returns
  • the 'size' of the object. The definition of 'size' depends on the object type. In particular: - For a dictionary or a stream object, the method will return the number of key/value pairs in the dictionary. - For an array object the method will return the number of Obj enties in the array. - For a string object the method will return the number of bytes in the string buffer. - For any other object the method will always return 1.

public void write (FilterWriter stream)

The function writes the Obj to the output stream.

Note: this method can be invoked on any Obj.

Parameters
stream - the input stream where the Obj will be written