Multivalent API

multivalent.std.adaptor.pdf
Class COS

java.lang.Object
  extended by multivalent.std.adaptor.pdf.COS

public final class COS
extends java.lang.Object

Translations between Java and PDF "COS" (Carousel Object System) data types.

Version:
$Revision: 1.8 $ $Date: 2005/02/20 05:57:57 $

Field Summary
static java.lang.Class CLASS_ARRAY
          Java type (Object[]) of PDF array data type (e.g., [ 41 63 572 729 ]).
static java.lang.Class CLASS_BOOLEAN
          Java type (Boolean) of PDF boolean data type (true or false).
static java.lang.Class CLASS_COMMENT
          Java type (char[]) of PDF comment data type (e.g., % comments run from '%' to end of line).
static java.lang.Class CLASS_DATA
          Java type (byte[]) for raw data, which is not a PDF data type, but which is sometimes mixed with them.
static java.lang.Class CLASS_DICTIONARY
          Java type (Dict) of PDF dictionary data type (e.g., << /Length 705 /Filter /FlateDecode >>).
static java.lang.Class CLASS_INTEGER
          Java type (Integer) of PDF integer number data type (e.g., 93515).
static java.lang.Class CLASS_IREF
          Java type (IRef) of PDF indirect reference data type (e.g., 15 0 R).
static java.lang.Class CLASS_NAME
          Java type (String) of PDF name data type (e.g., /Title).
static java.lang.Class CLASS_OBJSTMC
          If move object into a ObjStm, replace it with the object number of the ObjStm of this class (java.lang.Long) .
static java.lang.Class CLASS_REAL
          Java type (Double) of PDF real number data type (e.g., 0.9505).
static java.lang.Class CLASS_STRING
          Java type (StringBuffer) of PDF string data type (e.g., (PDF Reference) and <a47cc386aea60669950095583bec355d>).
static java.lang.String EOF
          String at end of trailer: "%%EOF".
static java.io.FileFilter FILTER
           
static int GEN_MAX
           
static java.lang.String KEY_COMPRESS
          Key in trailer for direct dictionary with compression information.
static java.lang.String KEY_COMPRESS_COMPACT
          Key in compression dictionary with indirect reference to Compact stream.
static java.lang.String KEY_COMPRESS_FILTER
          Key in compression dictionary that gives compression method.
static java.lang.String KEY_COMPRESS_LENGTHO
          Key in compression dictionary that gives original length of PDF.
static java.lang.String KEY_COMPRESS_ROOT
          Key in compression dictionary that points to original /Catalog.
static java.lang.String KEY_COMPRESS_SPECO
          Key in compression dictionary with major.
static java.lang.String KEY_COMPRESS_VERSION
          Key in compresion dictionary that gives specification version of compression filter.
static java.lang.Object OBJECT_DELETED
          Singleton object corresponding to freed/deleted objects, which can be created when a PDF is incrementally updated.
static java.lang.Object OBJECT_NULL
          Singleton PDF NULL object (which is not Java null).
static java.lang.String REALIZED
          Injected key for objects cached within dictionaries, such as fonts, images.
static java.lang.String SIGNATURE
          String at start of file (usually byte 0) that identifies as PDF: %PDF-m.n".
static java.lang.String SIGNATURE_FDF
          String at start of file (usually byte 0) that identifies as FDF: %FDF-.
static java.lang.String STREAM_DATA
          For stream dictionary, offset of data in file if of type Long, or data itself if of type byte[].
static byte XREF_FREE
          Cross reference type 0.
static byte XREF_NORMAL
          Cross reference type 1.
static byte XREF_OBJSTMC
          Cross reference type 2 (component of /Type /ObjStm).
 
Method Summary
static java.awt.Rectangle array2Rectangle(java.lang.Object[] oa, java.awt.geom.AffineTransform at)
          Converts PDF rectangle array (llx lly urx ury) to Java Rectangle (ulx,uly, width, height), normalized to have positive width and height.
static java.lang.StringBuffer createDate(long javatimemillis)
          Convert a Java time (since Jan 1 1970 GMT) into a PDF date in the current time zone.
static java.lang.StringBuffer createID(java.net.URI uri, Dict info)
          Computes value for trailer /ID, for initializing both if /ID doesn't exist or for updating the second value.
static long parseDate(java.lang.StringBuffer sb)
          Returns Java time of PDF Date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_IREF

public static final java.lang.Class CLASS_IREF
Java type (IRef) of PDF indirect reference data type (e.g., 15 0 R).


CLASS_DICTIONARY

public static final java.lang.Class CLASS_DICTIONARY
Java type (Dict) of PDF dictionary data type (e.g., << /Length 705 /Filter /FlateDecode >>). Dictionary keys are of type CLASS_NAME.


CLASS_ARRAY

public static final java.lang.Class CLASS_ARRAY
Java type (Object[]) of PDF array data type (e.g., [ 41 63 572 729 ]). Arrays can be heterogeneous. When creating new PDF array objects, always make a Object[] even though the array may be homogeneous of another type.


CLASS_NAME

public static final java.lang.Class CLASS_NAME
Java type (String) of PDF name data type (e.g., /Title).


CLASS_STRING

public static final java.lang.Class CLASS_STRING
Java type (StringBuffer) of PDF string data type (e.g., (PDF Reference) and <a47cc386aea60669950095583bec355d>). Note that PDF strings are not Java Strings.


CLASS_INTEGER

public static final java.lang.Class CLASS_INTEGER
Java type (Integer) of PDF integer number data type (e.g., 93515). Note PDF considers both integer and floating point the same type. When is possible to represent a number without lose of accuracy as an integer, this is preferred; this is what #readObject() does.


CLASS_REAL

public static final java.lang.Class CLASS_REAL
Java type (Double) of PDF real number data type (e.g., 0.9505).


CLASS_BOOLEAN

public static final java.lang.Class CLASS_BOOLEAN
Java type (Boolean) of PDF boolean data type (true or false).


CLASS_COMMENT

public static final java.lang.Class CLASS_COMMENT
Java type (char[]) of PDF comment data type (e.g., % comments run from '%' to end of line).


CLASS_DATA

public static final java.lang.Class CLASS_DATA
Java type (byte[]) for raw data, which is not a PDF data type, but which is sometimes mixed with them. Some applications cache the contents of a stream in the stream dictionary under the key STREAM_DATA, and if so remove the Length key in favor of taking this information from byte[].length. InputStreamComposite accepts such streams, and internally inline images are processed into such streams to make them identical to image XObjects for subsequent merged transformation.


OBJECT_NULL

public static final java.lang.Object OBJECT_NULL
Singleton PDF NULL object (which is not Java null). Equality can use == as well as Object.equals(Object). The PDF NULL object is referred to as "PDF NULL" or OBJECT_NULL; otherwise the term "null" refers to the Java null. Note that there is no CLASS_NULL; instead compare the object itself to this instance.


OBJECT_DELETED

public static final java.lang.Object OBJECT_DELETED
Singleton object corresponding to freed/deleted objects, which can be created when a PDF is incrementally updated. Equality can use == as well as Object.equals(Object).


SIGNATURE

public static final java.lang.String SIGNATURE
String at start of file (usually byte 0) that identifies as PDF: %PDF-m.n".

See Also:
Constant Field Values

SIGNATURE_FDF

public static final java.lang.String SIGNATURE_FDF
String at start of file (usually byte 0) that identifies as FDF: %FDF-.

See Also:
Constant Field Values

EOF

public static final java.lang.String EOF
String at end of trailer: "%%EOF".

See Also:
Constant Field Values

XREF_FREE

public static final byte XREF_FREE
Cross reference type 0.

See Also:
Constant Field Values

XREF_NORMAL

public static final byte XREF_NORMAL
Cross reference type 1.

See Also:
Constant Field Values

XREF_OBJSTMC

public static final byte XREF_OBJSTMC
Cross reference type 2 (component of /Type /ObjStm).

See Also:
Constant Field Values

GEN_MAX

public static final int GEN_MAX
See Also:
Constant Field Values

FILTER

public static final java.io.FileFilter FILTER

CLASS_OBJSTMC

public static final java.lang.Class CLASS_OBJSTMC
If move object into a ObjStm, replace it with the object number of the ObjStm of this class (java.lang.Long) .


STREAM_DATA

public static final java.lang.String STREAM_DATA
For stream dictionary, offset of data in file if of type Long, or data itself if of type byte[].

See Also:
Constant Field Values

REALIZED

public static final java.lang.String REALIZED
Injected key for objects cached within dictionaries, such as fonts, images.

See Also:
Constant Field Values

KEY_COMPRESS

public static final java.lang.String KEY_COMPRESS
Key in trailer for direct dictionary with compression information. Within dictionary, KEY_COMPRESS_LENGTHO, KEY_COMPRESS_FILTER, KEY_COMPRESS_VERSION, KEY_COMPRESS_COMPACT.

See Also:
Constant Field Values

KEY_COMPRESS_LENGTHO

public static final java.lang.String KEY_COMPRESS_LENGTHO
Key in compression dictionary that gives original length of PDF.

See Also:
Constant Field Values

KEY_COMPRESS_FILTER

public static final java.lang.String KEY_COMPRESS_FILTER
Key in compression dictionary that gives compression method.

See Also:
Constant Field Values

KEY_COMPRESS_VERSION

public static final java.lang.String KEY_COMPRESS_VERSION
Key in compresion dictionary that gives specification version of compression filter. Optional. Default: 1.0.

See Also:
Constant Field Values

KEY_COMPRESS_COMPACT

public static final java.lang.String KEY_COMPRESS_COMPACT
Key in compression dictionary with indirect reference to Compact stream.

See Also:
Constant Field Values

KEY_COMPRESS_SPECO

public static final java.lang.String KEY_COMPRESS_SPECO
Key in compression dictionary with major.minor of PDF specification compatibility modulo compression (Compact, ObjStm, ...).

See Also:
Constant Field Values

KEY_COMPRESS_ROOT

public static final java.lang.String KEY_COMPRESS_ROOT
Key in compression dictionary that points to original /Catalog.

See Also:
Constant Field Values
Method Detail

array2Rectangle

public static java.awt.Rectangle array2Rectangle(java.lang.Object[] oa,
                                                 java.awt.geom.AffineTransform at)
Converts PDF rectangle array (llx lly urx ury) to Java Rectangle (ulx,uly, width, height), normalized to have positive width and height. Java rectangle in PDF coordinate space as described in passed AffineTransform.


parseDate

public static long parseDate(java.lang.StringBuffer sb)
                      throws java.lang.InstantiationException
Returns Java time of PDF Date. PDF dates have the form (D:20010406143021).

Parameters:
local - convert time to local time
Throws:
java.lang.InstantiationException
See Also:
createDate(long)

createDate

public static java.lang.StringBuffer createDate(long javatimemillis)
Convert a Java time (since Jan 1 1970 GMT) into a PDF date in the current time zone.

See Also:
#parseDate(StringBuffer, boolean)

createID

public static java.lang.StringBuffer createID(java.net.URI uri,
                                              Dict info)
Computes value for trailer /ID, for initializing both if /ID doesn't exist or for updating the second value. Done on reads rather than writes so that guaranteed valid for subsequent operations. Returned StringBuffer 16 characters (8-bit bytes) long.


Multivalent API