public class Obj
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
e_array
The Constant e_array.
|
static int |
e_bool
The Constant e_bool.
|
static int |
e_dict
The Constant e_dict.
|
static int |
e_name
The Constant e_name.
|
static int |
e_null
The Constant e_null.
|
static int |
e_number
The Constant e_number.
|
static int |
e_stream
The Constant e_stream.
|
static int |
e_string
The Constant e_string.
|
Modifier and Type | Method and Description |
---|---|
static Obj |
__Create(long impl,
java.lang.Object ref) |
long |
__GetHandle() |
java.lang.Object |
__GetRefHandle() |
void |
erase(DictIterator pos)
Removes an element in the dictionary from specified position.
|
void |
erase(java.lang.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(java.lang.String key)
Search the dictionary for a given key.
|
Obj |
findObj(java.lang.String key)
Search the dictionary for a given key.
|
DictIterator |
get(java.lang.String key)
Search the dictionary for a given key and throw an exception if the key is not found.
|
java.lang.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
|
Filter |
getDecodedStream()
Get the decoded stream.
|
DictIterator |
getDictIterator()
Get the dictionary iterator.
|
SDFDoc |
getDoc()
Get the Doc object contains this Obj
|
short |
getGenNum()
Get the generation number.
|
java.lang.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.
|
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,
java.lang.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,
java.awt.geom.Rectangle2D.Double rect)
Inserts an array of 4 numbers in this array.
|
Obj |
insertString(int pos,
byte[] value)
Inserts an Obj::Type::e_string object in the array.
|
Obj |
insertString(int pos,
java.lang.String value)
Inserts an Obj::Type::e_string object in the array.
|
Obj |
insertText(int pos,
java.lang.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
|
boolean |
isContainer()
Checks if Obj is a container object.
|
boolean |
isDict()
Checks if Obj is dictionary
|
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
|
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(java.lang.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(double x1,
double y1,
double x2,
double y2)
Appends an array of 4 numbers at the end of the array.
|
Obj |
pushBackRect(java.awt.geom.Rectangle2D.Double rect)
Appends an array of 4 numbers 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 |
pushBackString(java.lang.String value)
Appends a new Obj::Type::e_string object at the end of the array.
|
Obj |
pushBackText(java.lang.String value)
Appends a new Obj::Type::e_string object at the end of the array.
|
Obj |
put(java.lang.String key,
Obj obj)
Inserts a <key, Obj> pair in the dictionary.
|
Obj |
putArray(java.lang.String key)
Inserts a <key, Obj::Type::e_array> pair in the dictionary.
|
Obj |
putBool(java.lang.String key,
boolean value)
Inserts a <key, Obj::Type::e_bool> pair in the dictionary.
|
Obj |
putDict(java.lang.String key)
Inserts a <key, Obj::Type::e_dict> pair in the dictionary.
|
Obj |
putMatrix(java.lang.String key,
Matrix2D value)
Inserts a <key, [a,b,c,d,h,v]> pair in the dictionary.
|
Obj |
putName(java.lang.String key,
java.lang.String name)
Inserts a <key, Obj::Type::e_name> pair in the dictionary.
|
void |
putNull(java.lang.String key)
Inserts a <key, Obj::Type::e_null> pair in the dictionary.
|
Obj |
putNumber(java.lang.String key,
double value)
Inserts a <key, Obj::Type::e_number> pair in the dictionary.
|
Obj |
putRect(java.lang.String key,
double x1,
double y1,
double x2,
double y2)
Inserts a <key, [x1,y1,x2,y2]> pair in the dictionary.
|
Obj |
putRect(java.lang.String key,
java.awt.geom.Rectangle2D.Double rect)
Inserts a <key, [x1,y1,x2,y2]> pair in the dictionary.
|
Obj |
putString(java.lang.String key,
byte[] value)
Inserts a <key, Obj::Type::e_string> pair in the dictionary.
|
Obj |
putString(java.lang.String key,
java.lang.String value)
Inserts a <key, Obj::Type::e_string> pair in the dictionary.
|
Obj |
putText(java.lang.String key,
java.lang.String value)
Inserts a <key, Obj::Type::e_string> pair in the dictionary.
|
boolean |
rename(java.lang.String old_key,
java.lang.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(java.lang.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(java.lang.String value)
Set the string object value.
|
long |
size()
Get size of Obj
|
void |
write(FilterWriter stream)
The function writes the Obj to the output stream.
|
public static final int e_null
public static final int e_bool
public static final int e_number
public static final int e_name
public static final int e_string
public static final int e_dict
public static final int e_array
public static final int e_stream
public int getType() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isBool() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isNumber() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isNull() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isString() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isName() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isIndirect() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isContainer() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isDict() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isArray() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isStream() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public SDFDoc getDoc() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public void write(FilterWriter stream) throws PDFNetException
Note: this method can be invoked on any Obj.
stream
- - the input stream where the Obj will be writtenPDFNetException
public long size() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public long getObjNum() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public short getGenNum() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public long getOffset() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isFree() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public void setMark(boolean mark) throws PDFNetException
Note: this method can be invoked on any Obj.
mark
- the new markPDFNetException
public boolean isMarked() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isLoaded() throws PDFNetException
Note: this method can be invoked on any Obj.
PDFNetException
public boolean isEqual(Obj to) throws PDFNetException
to
- the toPDFNetException
public boolean getBool() throws PDFNetException
PDFNetException
public void setBool(boolean b) throws PDFNetException
b
- - bool value used to set Bool object.PDFNetException
public double getNumber() throws PDFNetException
PDFNetException
public void setNumber(double n) throws PDFNetException
n
- - value used to set Number object.PDFNetException
public byte[] getBuffer() throws PDFNetException
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.
PDFNetException
public java.lang.String getAsPDFText() throws PDFNetException
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'.
PDFNetException
public void setString(byte[] buf) throws PDFNetException
buf
- the new string bufferPDFNetException
public void setString(java.lang.String value) throws PDFNetException
value
- the new stringPDFNetException
public java.lang.String getName() throws PDFNetException
PDFNetException
public void setName(java.lang.String name) throws PDFNetException
name
- - value used to set Name object.PDFNetException
public DictIterator getDictIterator() throws PDFNetException
PDFNetException
- DictIterator itr = dict.getDictIterator();
while (itr.hasNext()) {
Obj key = itr.key();
Obj value = itr.value();
// ...
itr.next()
}
public DictIterator find(java.lang.String key) throws PDFNetException
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");
}
key
- - a key to search for in the dictionaryPDFNetException
public Obj findObj(java.lang.String key) throws PDFNetException
Note: A dictionary entry whose value is Obj::Null is equivalent to an absent entry.
key
- - a key to search for in the dictionaryPDFNetException
public DictIterator get(java.lang.String key) throws PDFNetException
key
- - a key to search for in the dictionaryPDFNetException
public Obj putName(java.lang.String key, java.lang.String name) throws PDFNetException
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.
key
- The key of the value to set.name
- The value of the Obj::Type::e_name object to be inserted into
the dictionary.PDFNetException
public Obj putArray(java.lang.String key) throws PDFNetException
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.
key
- The key of the value to set.PDFNetException
public Obj putBool(java.lang.String key, boolean value) throws PDFNetException
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.
key
- The key of the value to set.value
- The value of the Obj::Type::e_bool object to be inserted into
the dictionary.PDFNetException
public Obj putDict(java.lang.String key) throws PDFNetException
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.
key
- The key of the value to set.PDFNetException
public Obj putNumber(java.lang.String key, double value) throws PDFNetException
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.
key
- The key of the value to set.value
- The value of the Obj::Type::e_number object to be inserted into
the dictionary.PDFNetException
public Obj putString(java.lang.String key, java.lang.String value) throws PDFNetException
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.
key
- The key of the value to set.value
- The value of the Obj::Type::e_string object to be inserted into
the dictionary.PDFNetException
public Obj putString(java.lang.String key, byte[] value) throws PDFNetException
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.
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.PDFNetException
public Obj putText(java.lang.String key, java.lang.String value) throws PDFNetException
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.
key
- The key of the value to set.value
- The value of the Obj::Type::e_string object to be inserted into
the dictionary.PDFNetException
public void putNull(java.lang.String key) throws PDFNetException
Note: The effect of calling this method is essentially the same as dict.Erase(key) .
key
- The key of the value to set.PDFNetException
public Obj put(java.lang.String key, Obj obj) throws PDFNetException
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.PDFNetException
public Obj putRect(java.lang.String key, double x1, double y1, double x2, double y2) throws PDFNetException
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.
key
- The key of the value to set.x1
- the x1y1
- the y1x2
- the x2y2
- the y2PDFNetException
public Obj putRect(java.lang.String key, java.awt.geom.Rectangle2D.Double rect) throws PDFNetException
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.
key
- The key of the value to set.rect
- - The values for an array of four numbers to be
inserted into the dictionary.PDFNetException
public Obj putMatrix(java.lang.String key, Matrix2D value) throws PDFNetException
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.
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.PDFNetException
public void erase(java.lang.String key) throws PDFNetException
key
- the keyPDFNetException
public void erase(DictIterator pos) throws PDFNetException
pos
- the posPDFNetException
public boolean rename(java.lang.String old_key, java.lang.String new_key) throws PDFNetException
old_key
- the old_keynew_key
- the new_keyPDFNetException
public Obj getAt(int index) throws PDFNetException
index
- - The array element to obtain. The first element in an array has an index of zero.PDFNetException
public Obj insertName(int pos, java.lang.String name) throws PDFNetException
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.PDFNetException
public Obj insertArray(int pos) throws PDFNetException
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.PDFNetException
public Obj insertBool(int pos, boolean value) throws PDFNetException
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.PDFNetException
public Obj insertDict(int pos) throws PDFNetException
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.PDFNetException
public Obj insertNumber(int pos, double value) throws PDFNetException
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.PDFNetException
public Obj insertString(int pos, java.lang.String value) throws PDFNetException
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.PDFNetException
public Obj insertString(int pos, byte[] value) throws PDFNetException
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.PDFNetException
public Obj insertText(int pos, java.lang.String value) throws PDFNetException
Note: InsertText will create the string object as a 'PDF Text' object.
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.PDFNetException
public Obj insertNull(int pos) throws PDFNetException
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.PDFNetException
public Obj insert(int pos, Obj obj) throws PDFNetException
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.PDFNetException
public Obj insertRect(int pos, double x1, double y1, double x2, double y2) throws PDFNetException
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 x1y1
- the y1x2
- the x2y2
- the y2PDFNetException
public Obj insertRect(int pos, java.awt.geom.Rectangle2D.Double rect) throws PDFNetException
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.PDFNetException
public Obj insertMatrix(int pos, Matrix2D value) throws PDFNetException
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.PDFNetException
public Obj pushBackName(java.lang.String name) throws PDFNetException
name
- - The value of the Obj::Type::e_name object.PDFNetException
public Obj pushBackArray() throws PDFNetException
PDFNetException
public Obj pushBackBool(boolean value) throws PDFNetException
value
- the valuePDFNetException
public Obj pushBackDict() throws PDFNetException
PDFNetException
public Obj pushBackNumber(double value) throws PDFNetException
value
- - The value of the Obj::Type::e_number object.PDFNetException
public Obj pushBackString(java.lang.String value) throws PDFNetException
value
- - The value of the Obj::Type::e_string object.PDFNetException
public Obj pushBackString(byte[] value) throws PDFNetException
value
- The buffer used to set the value of the Obj::Type::e_string
object to be inserted.PDFNetException
public Obj pushBackText(java.lang.String value) throws PDFNetException
Note: InsertText will create the string object as a 'PDF Text' object.
value
- The value of the Obj::Type::e_string object to be inserted.PDFNetException
public Obj pushBackNull() throws PDFNetException
PDFNetException
public Obj pushBack(Obj obj) throws PDFNetException
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.PDFNetException
public Obj pushBackRect(double x1, double y1, double x2, double y2) throws PDFNetException
x1
- the x1y1
- the y1x2
- the x2y2
- the y2PDFNetException
public Obj pushBackRect(java.awt.geom.Rectangle2D.Double rect) throws PDFNetException
rect
- - The value for an array of four numbers to be
appended.PDFNetException
public Obj pushBackMatrix(Matrix2D value) throws PDFNetException
value
- - A matrix used to set the values in an array of six numbers.
The resulting array will be then inserted in this array.PDFNetException
public void eraseAt(int pos) throws PDFNetException
pos
- the posPDFNetException
public long getRawStreamLength() throws PDFNetException
PDFNetException
public Filter getRawStream(boolean decrypt) throws PDFNetException
decrypt
- - If true decrypt the stream if the stream is encrypted.PDFNetException
public Filter getDecodedStream() throws PDFNetException
PDFNetException
public void setStreamData(byte[] data, Filter filter_chain) throws PDFNetException
data
- the character array with the new content streamfilter_chain
- the filter_chain to be applied to the streamPDFNetException
public static Obj __Create(long impl, java.lang.Object ref)
public long __GetHandle()
public java.lang.Object __GetRefHandle()