PdfStream

Overview

PdfStream is a class in Aspose.PDF FOSS for Java. Inherits from: PdfDictionary.

PDF stream object (§7.3.8, ISO 32000-1:2008).

This class provides 54 methods for working with PdfStream objects in Java programs. Available methods include: PdfDictionary, PdfStream, accept, containsKey, equals, get, getArray, getBoolean, getDecodedData, getDecodedStream, getDictionary, getEncodedData, and 40 additional methods. All public members are accessible to any Java application after installing the Aspose.PDF FOSS for Java package. Properties: decodedData, decodedStream, dictionary, dirty, empty, encodedData, and 8 more.

Properties

NameTypeAccessDescription
dictionaryPdfDictionaryReadReturns this stream as a dictionary.
encodedDatabyte[]ReadReturns the encoded data (as stored in the PDF file).
encodedStreamInputStreamReadReturns the encoded data as an InputStream.
decodedDatabyte[]ReadReturns the decoded data (after applying filters in reverse order).
decodedStreamInputStreamReadReturns the decoded data as an InputStream.
lengthlongReadReturns the length of the encoded data.
filtersList<PdfName>ReadReturns the list of filter names from /Filter.
emptybooleanReadReturns whether the dictionary is empty.
typeStringReadReturns the /Type value as a string (e.g.
subtypeStringReadReturns the /Subtype (or /S) value as a string, or null.
pathPdfBaseReadTraverses nested dictionaries by key path.
dirtybooleanReadReturns {@code true} if this object was modified since loading.
indirectbooleanReadReturns whether this object is an indirect object (has an object key).
objectKeyPdfObjectKeyReadReturns the indirect object key, or {@code null} for direct objects.

Methods

SignatureDescription
PdfStream()Creates an empty stream.
PdfStream(encodedData: byte[])Creates a stream with the given encoded data.
PdfStream(dict: PdfDictionary, encodedData: byte[])Creates a stream from an existing dictionary and encoded data.
getDictionary()PdfDictionaryReturns this stream as a dictionary.
getEncodedData()byte[]Returns the encoded data (as stored in the PDF file).
getEncodedStream()InputStreamReturns the encoded data as an InputStream.
getDecodedData()byte[]Returns the decoded data (after applying filters in reverse order).
getDecodedStream()InputStreamReturns the decoded data as an InputStream.
setDecodedData(data: byte[])Sets the decoded data.
setEncodedData(data: byte[])Sets the encoded data directly.
hasActiveDecryptor()booleanReturns true if this stream has an active decryptor attached (i.e.
materializeDecryption()booleanDecrypts {@code encodedData} in place and detaches the decryptor, leaving
the stream looking exactly like an equivalent unencrypted stream loaded
from disk.
hasPendingDecodedData()booleanReturns whether the stream has pending decoded data set via
{@link #setDecodedData(byte[])} that has not yet been re-encoded by
{@link #prepareEncodedData()}.
setDecryptor(decryptor: PDFDecryptor, objNum: int, genNum: int)Sets the decryptor for this stream (called by PDFParser for encrypted PDFs).
getLength()longReturns the length of the encoded data.
getFilters()List<PdfName>Returns the list of filter names from /Filter.
setFilter(filter: PdfName)Sets a single filter.
setFilters(filters: List<PdfName>)Sets multiple filters.
prepareEncodedData()byte[]Ensures pending decoded data is encoded through filters and returns the
encoded bytes.
writeTo(os: OutputStream)
accept(visitor: IPdfVisitor<T>)T
toString()String
PdfDictionary()Creates an empty dictionary.
size()intReturns the number of entries.
isEmpty()booleanReturns whether the dictionary is empty.
containsKey(key: PdfName)booleanReturns whether the dictionary contains the given key.
get(key: PdfName)PdfBaseReturns the value for the given key, or null.
set(key: PdfName, value: PdfBase)Sets a key-value pair.
remove(key: PdfName)PdfBaseRemoves a key.
keySet()Set<PdfName>Returns the set of keys.
values()Collection<PdfBase>Returns the collection of values.
getInt(key: String, defaultValue: int)intReturns the value as an int, or the default.
getLong(key: String, defaultValue: long)longReturns the value as a long, or the default.
getFloat(key: String, defaultValue: float)floatReturns the value as a float, or the default.
getBoolean(key: String, defaultValue: boolean)booleanReturns the value as a boolean, or the default.
getNameAsString(key: String)StringReturns the value as a name string, or null.
getString(key: String)StringReturns the value as a decoded string, or null.
getArray(key: String)PdfArrayReturns the value as a PdfArray, or null.
setInt(key: String, value: int)Sets an integer value.
setFloat(key: String, value: float)Sets a float value.
setBoolean(key: String, value: boolean)Sets a boolean value.
setName(key: String, nameValue: String)Sets a name value.
setString(key: String, stringValue: String)Sets a string value.
getType()StringReturns the /Type value as a string (e.g.
getSubtype()StringReturns the /Subtype (or /S) value as a string, or null.
getPath()PdfBaseTraverses nested dictionaries by key path.
iterator()Iterator<Map.Entry<PdfName, PdfBase>>
equals(o: Object)boolean
hashCode()int
isDirty()booleanReturns {@code true} if this object was modified since loading.
setDirty(dirty: boolean)Sets the dirty flag on this object.
isIndirect()booleanReturns whether this object is an indirect object (has an object key).
getObjectKey()PdfObjectKeyReturns the indirect object key, or {@code null} for direct objects.
setObjectKey(key: PdfObjectKey)Sets the indirect object key.

See Also