COSStream
Overview
COSStream is a class in Aspose.Pdf FOSS for Java.
Inherits from: COSDictionary.
PDF stream object (§7.3.8, ISO 32000-1:2008).
Properties
| Name | Type | Access | Description |
|---|---|---|---|
dictionary | COSDictionary | Read | Returns this stream as a dictionary. |
encodedData | byte[] | Read | Returns the encoded data (as stored in the PDF file). |
encodedStream | InputStream | Read | Returns the encoded data as an InputStream. |
decodedData | byte[] | Read | Returns the decoded data (after applying filters in reverse order). |
decodedStream | InputStream | Read | Returns the decoded data as an InputStream. |
length | long | Read | Returns the length of the encoded data. |
filters | List<COSName> | Read | Returns the list of filter names from /Filter. |
empty | boolean | Read | Returns whether the dictionary is empty. |
type | String | Read | Returns the /Type value as a string (e.g. |
subtype | String | Read | Returns the /Subtype (or /S) value as a string, or null. |
path | COSBase | Read | Traverses nested dictionaries by key path. |
dirty | boolean | Read | Returns {@code true} if this object was modified since loading. |
indirect | boolean | Read | Returns whether this object is an indirect object (has an object key). |
objectKey | COSObjectKey | Read | Returns the indirect object key, or {@code null} for direct objects. |
Methods
| Signature | Description |
|---|---|
COSStream() | Creates an empty stream. |
COSStream(encodedData: byte[]) | Creates a stream with the given encoded data. |
COSStream(dict: COSDictionary, encodedData: byte[]) | Creates a stream from an existing dictionary and encoded data. |
getDictionary() → COSDictionary | Returns this stream as a dictionary. |
getEncodedData() → byte[] | Returns the encoded data (as stored in the PDF file). |
getEncodedStream() → InputStream | Returns the encoded data as an InputStream. |
getDecodedData() → byte[] | Returns the decoded data (after applying filters in reverse order). |
getDecodedStream() → InputStream | Returns the decoded data as an InputStream. |
setDecodedData(data: byte[]) | Sets the decoded data. |
setEncodedData(data: byte[]) | Sets the encoded data directly. |
hasActiveDecryptor() → boolean | Returns true if this stream has an active decryptor attached (i.e. |
materializeDecryption() → boolean | Decrypts {@code encodedData} in place and detaches the decryptor, leaving |
| the stream looking exactly like an equivalent unencrypted stream loaded | |
| from disk. | |
hasPendingDecodedData() → boolean | Returns 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() → long | Returns the length of the encoded data. |
getFilters() → List<COSName> | Returns the list of filter names from /Filter. |
setFilter(filter: COSName) | Sets a single filter. |
setFilters(filters: List<COSName>) | Sets multiple filters. |
prepareEncodedData() → byte[] | Ensures pending decoded data is encoded through filters and returns the |
| encoded bytes. | |
writeTo(os: OutputStream) | |
accept(visitor: ICOSVisitor<T>) → T | |
toString() → String | |
COSDictionary() | Creates an empty dictionary. |
size() → int | Returns the number of entries. |
isEmpty() → boolean | Returns whether the dictionary is empty. |
containsKey(key: COSName) → boolean | Returns whether the dictionary contains the given key. |
get(key: COSName) → COSBase | Returns the value for the given key, or null. |
set(key: COSName, value: COSBase) | Sets a key-value pair. |
remove(key: COSName) → COSBase | Removes a key. |
keySet() → Set<COSName> | Returns the set of keys. |
values() → Collection<COSBase> | Returns the collection of values. |
getInt(key: String, defaultValue: int) → int | Returns the value as an int, or the default. |
getLong(key: String, defaultValue: long) → long | Returns the value as a long, or the default. |
getFloat(key: String, defaultValue: float) → float | Returns the value as a float, or the default. |
getBoolean(key: String, defaultValue: boolean) → boolean | Returns the value as a boolean, or the default. |
getNameAsString(key: String) → String | Returns the value as a name string, or null. |
getString(key: String) → String | Returns the value as a decoded string, or null. |
getArray(key: String) → COSArray | Returns the value as a COSArray, 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() → String | Returns the /Type value as a string (e.g. |
getSubtype() → String | Returns the /Subtype (or /S) value as a string, or null. |
getPath() → COSBase | Traverses nested dictionaries by key path. |
iterator() → Iterator<Map.Entry<COSName, COSBase>> | |
equals(o: Object) → boolean | |
hashCode() → int | |
isDirty() → boolean | Returns {@code true} if this object was modified since loading. |
setDirty(dirty: boolean) | Sets the dirty flag on this object. |
isIndirect() → boolean | Returns whether this object is an indirect object (has an object key). |
getObjectKey() → COSObjectKey | Returns the indirect object key, or {@code null} for direct objects. |
setObjectKey(key: COSObjectKey) | Sets the indirect object key. |