PDFStream Class Documentation

classPDFStream : PDFObject

Namespace:com::datalogics::PDFL

Inherits from:
PDFObject

Detailed Description

Represents a stream of data within a PDF document. All objects in a PDF document are built from a collection of simpler objects that represent fundamental datatypes like numbers, strings and arrays.

PDFObject and its subclasses allow direct access and manipulation of these simple objects. Some subclasses represent single data elements (e.g. PDFInteger represents a single integer value); other subclasses represent a collection of PDFObjects (e.g. PDFArray is an indexed array of data elements).

A PDFStream represents a stream of unsigned bytes, and may be inserted into any collection object. It includes a dictionary that describes how the data in the stream is encoded and other useful information about the stream. A PDFStream is always an indirect object.

PDFStreams can be encoded using built-in filters. These filters include compression schemes for most popular image formats, and text encoding translators to permit safe transmission of the document over the Internet. The data in a PDFStream will be automatically encoded when it is created; the user can read either the encoded (raw) or decoded (filtered) data.

PDFStreams can be used for any large collection of data that need not be read into memory all at once, including image data, multimedia data or XML markup.

Constructor & Destructor Documentation

PDFStream

PDFStream(BaseInputNozzlenozzle, Documentdoc, PDFDictencoding_dict, PDFArrayencoding_params)

Parameters

nozzle: BaseInputNozzle

An input nozzle providing the stream data.

doc: Document

The Document in which this PDFStream is created.

encoding_dict: PDFDict

A PDFDict describing the encoding filters for this stream, or null for no encoding.

encoding_params: PDFArray

A PDFArray describing parameters for the encoding filters, or null for defaults.

Creates a new PDFStream in the specified document.

PDFStream

PDFStream(BaseInputNozzlenozzle, PDFObjectdocFromObj, PDFDictencoding_dict, PDFArrayencoding_params)

Parameters

nozzle: BaseInputNozzle

An input nozzle providing the stream data.

docFromObj: PDFObject

A PDFObject whose document will contain the new PDFStream.

encoding_dict: PDFDict

A PDFDict describing the encoding filters for this stream, or null for no encoding.

encoding_params: PDFArray

A PDFArray describing parameters for the encoding filters, or null for defaults.

Creates a new PDFStream in the same document as the given PDFObject.

Member Function Documentation

DisposeChildren

voidDisposeChildren()

Returns:

void

SetData

voidSetData(java.io.InputStreamstream, PDFDictencoding_dict, PDFArrayencoding_params)

Parameters

stream: java.io.InputStream
encoding_dict: PDFDict
encoding_params: PDFArray

Returns:

void

[static initializer]

static void[static initializer]()

clone

PDFObjectclone()

Returns:

A new PDFObject that is a copy of this object.

Makes a new copy of this PDFObject in memory, in the same document and using same direct/indirect setting as this PDFObject.

clone

Parameters

doc: Document

The target document in which to create the copy.

Returns:

A new PDFObject that is a copy of this object in the specified document.

Makes a new copy of this PDFObject in memory, in the supplied document, using the same direct/indirect setting as this PDFObject.

clone

PDFObjectclone(Documentdoc, booleanindirect)

Parameters

doc: Document

The target document in which to create the copy.

indirect: boolean

If true, the copy will be an indirect object; if false, it will be direct.

Returns:

A new PDFObject that is a copy of this object in the specified document.

Makes a new copy of this PDFObject in memory, in the supplied document, using supplied direct/indirect setting.

clone

Parameters

obj: PDFObject

The reference object whose document will be used for the copy.

Returns:

A new PDFObject that is a copy of this object in the same document as obj.

Makes a new copy of this PDFObject in memory, in the same document as another object, using the same direct/indirect setting as this PDFObject.

clone

PDFObjectclone(PDFObjectobj, booleanindirect)

Parameters

obj: PDFObject

The reference object whose document will be used for the copy.

indirect: boolean

If true, the copy will be an indirect object; if false, it will be direct.

Returns:

A new PDFObject that is a copy of this object in the same document as obj.

Makes a new copy of this PDFObject in memory, in the same document as another object, using supplied direct/indirect setting.

compareTo

PDFObjectComparisoncompareTo(PDFObjectrhs)

Parameters

rhs: PDFObject

the other PDFObject to compare.

Returns:

A PDFObjectComparison value that relates this object to the rhs object

Compares this object to another object. The result is useful for ordering or sorting PDFObjects. No other significance should be attached to the result. In particular, an unequal result indicates nothing about the type of either object.

The result is valid only within a single instance of the document.

delete

synchronized voiddelete(Booleandisposing)

Parameters

disposing: Boolean

Returns:

synchronized void

delete

synchronized voiddelete()

Returns:

synchronized void

destroy

voiddestroy()

Returns:

void

Destroys this object.

This method does nothing if this object is a direct scalar object.

If a composite object (an array, dictionary or stream) is destroyed:
All the direct objects in it are automatically destroyed.

The indirect objects in it are not destroyed.

enumPDFObjects

booleanenumPDFObjects(PDFObjectEnumProcenumProc)

Parameters

enumProc: PDFObjectEnumProc

A user-supplied callback to call for each element of the object. of obj. Neither proc nor any routine called by proc may modify the object. Doing so can produce undefined results or errors. For example, if the object is an array, enumProc must not call Remove(); if the object is a dictionary, enumProc must not call Put().

Returns:

Returns true if every call to enumProc returned true. As soon as any call to enumProc returns false, the enumeration stops and EnumPDFObject() returns false.

Enumerates the elements of a PDFObject by calling a user-supplied procedure for each component of the object.
For scalars or strings, the proc is not called, and CosObjEnum() returns true.

For dictionaries, proc is called for each key-value pair. The order in which the key-value pairs are enumerated is undefined.

For arrays, proc is called with each element as the first paramater to proc, and the NULL object as the second parameter. Array elements are enumerated in ascending order of index.

For streams, proc is called once, with the stream's dictionary as the first parameter to the proc and the NULL object as the second parameter.

equals

booleanequals(Objectrhs)

Parameters

rhs: Object

Returns:

boolean

finalize

voidfinalize()

Returns:

void

getDict

PDFDictgetDict()

Returns:

The stream's encoding dictionary.

The encoding dictionary for the stream. This includes all required information for decoding the stream, such as filter names and decode parameters.

getDocument

DocumentgetDocument()

Returns:

the Document in which the object resides.

The Document of which this object is a member. Returns null if the Document is not known by PDFL, or if it is a temporary document.

If the Document is not null, then it shares the same internal data with other Document objects that refer to the same file. Document objects returned this way do not contribute to the internal count that keeps the Document open, and will become invalid if the main reference to the document is disposed.

getFilteredStream

java.io.InputStreamgetFilteredStream()

Returns:

java.io.InputStream

getGeneration

intgetGeneration()

Returns:

The generation number of this indirect object.

The generation number for this object. Only indirect objects have a generation number.

getID

intgetID()

Returns:

The ID number of this indirect object.

The ID number for this object. Only indirect objects have an ID number.

getIndirect

booleangetIndirect()

Returns:

true if this object is indirect, false if it is direct.

Indicates if this object is indirect or direct.

getLength

intgetLength()

Returns:

The length of the encoded (raw) stream data.

The encoded length of the stream in bytes.

getOutputNozzle

OutputNozzlegetOutputNozzle(PDFStreamOpenModemode)

Parameters

mode: PDFStreamOpenMode

The open mode controlling decryption and filtering of the stream data.

Returns:

An OutputNozzle from which the stream data can be read.

Opens this PDFStream for reading and returns an OutputNozzle.

getPDFHashValue

intgetPDFHashValue()

Returns:

The 32-bit hash value for this object.

The 32-bit hash value for this object. The hash value is used internally to quickly access the object, and is not generally useful for PDFObject users. Note that two PDFObjects with equal hash values are not necessarily equal; use Equals() to check for equality.

getStream

java.io.InputStreamgetStream(PDFStreamOpenModemode)

Parameters

mode: PDFStreamOpenMode

Returns:

java.io.InputStream

getStreamPos

intgetStreamPos()

Returns:

The byte position of this stream within the PDF file.

The byte offset of this stream in the PDF file.

getUnfilteredStream

java.io.InputStreamgetUnfilteredStream()

Returns:

java.io.InputStream

sameTypeEquals

booleansameTypeEquals(PDFObjectobj)

Parameters

Returns:

boolean

toString

StringtoString()

Returns:

A string describing this PDFStream, including its indirect/direct status and ID.

Returns a string representation of this PDFStream.