Skip navigation links

Package com.adobe.internal.pdftoolkit.core.cos

The Gibson cos layer model is based on the PDF 1.7 spec.

See: Description

Package com.adobe.internal.pdftoolkit.core.cos Description

The Gibson cos layer model is based on the PDF 1.7 spec. It provides complete support for the spec.

1. Basic Cos Object Types

There are two categories of cos object types: atomic and collection. Atomic types correspond to kinds of values, and collection types correspond to collections of cos objects. All cos object types are descendents of CosObject. All CosObjects share the following attributes:

1.1 Atomic types

1.1.1 CosScalar

Each of these types encapsulates a primitive value or Adobe primitive value. These types are descendents of CosScalar.

1.1.2 CosString

This type encapsulates a string as a byte array which may be encoded as a string according to the platform specific encoding or a hex string. The type supports encryption based on parameters provided by the CosDocument context.

1.1.3 CosNull

This type contains a null value.

1.2 Collection types

Each of these types has attributes for managing a collection of CosObjects. They all are descendents of CosContainer.

1.2.1 CosArray

This collection supports the behavior of ArrayList (an indexed, ordered list). The elements must be of type CosObject.

1.2.2 CosDictionary

This collection supports the behavior of HashMap. The keys must be of type ASName, and the values must be of type CosObject.

1.2.3 CosStream

This is a child class of CosDictionary because a CosStream is composed of a dictionary part and a data stream part. The dictionary part is a CosDictionary. There are additional attributes for managing the data stream. The data stream may be encrypted using CosDocument encryption parameters or its own set. The data stream additionally may be encoded using filters defined as entries in the object's dictionary.

1.2.4 CosObjectStream

This is a child class of CosStream. The data in the data stream are compressed objects (cos objects written to the data stream and not to the CosDocument). There are attributes for managing the collection of compressed objects associated with this object.

2. Cos Document

CosDocument defines the context within which a collection of CosObjects exists. A CosDocument instance manages creation of, access to, and deletion of all CosObjects in its collection. In addition, a CosDocument instance can produce an output (in PDF file format as specified by the PDF 1.7 spec) of its collection of objects - this output is a save.

2.1 Direct and Indirect Cos Objects

According to the PDF 1.7 spec, most CosObjects can be either direct or indirect. There are exceptions; CosStream objects can only be indirect. There also are some implementation dependent exceptions for CosObjects being used in particular roles within the CosDocument.

All CosObject creation methods are supported by an API through a singleton CosObjectFactory instance. It is possible to create direct or indirect CosObjects explicitly using the CosObjectFactory methods.

An indirect object can be referenced directly by a CosObjectID which is unique within the CosDocument context. Only indirect objects have entries in the xref section of a CosDocument. A direct object cannot be referenced directly; all direct objects have a null CosObjectID (object number and generation number of 0).

Here are CosDocument attributes for managing direct and indirect objects:

Skip navigation links

Copyright © 2010 - 2020 Adobe. All Rights Reserved