public class COSStream extends COSDictionary implements Closeable, Encryptable
| Constructor and Description |
|---|
COSStream() |
COSStream(COSDictionary dictionary) |
COSStream(COSDictionary dictionary,
org.sejda.io.SeekableSource seekableSource,
long startingPosition,
long length)
Creates a stream with the given dictionary and where filtered data is a view of the given
SeekableSource. |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(COSVisitor visitor)
Visitor pattern for the COS model objects
|
boolean |
addCompression()
Adds Flate decode filter to the current filters list if possible
|
String |
asTextString() |
void |
close() |
OutputStream |
createFilteredStream()
Creates a new stream for which filtered byte should be written to.
|
OutputStream |
createFilteredStream(COSBase filters)
Returns a new OutputStream for writing stream data, using and the given filters.
|
OutputStream |
createUnfilteredStream()
This will create an output stream that can be written to.
|
protected InputStream |
doGetFilteredStream() |
boolean |
encryptable() |
void |
encryptable(boolean encryptable)
Sets if the object can be encrypted
|
DecodeResult |
getDecodeResult() |
long |
getFilteredLength() |
org.sejda.io.SeekableSource |
getFilteredSource() |
InputStream |
getFilteredStream() |
COSBase |
getFilters()
This will return the filters to apply to the byte stream.
|
ByteBuffer |
getUnfilteredByteBuffer() |
long |
getUnfilteredLength() |
org.sejda.io.SeekableSource |
getUnfilteredSource() |
InputStream |
getUnfilteredStream() |
boolean |
hasFilter(COSName filter) |
boolean |
indirectLength() |
void |
indirectLength(boolean indirectLength) |
boolean |
isEmpty() |
void |
setEncryptor(Function<InputStream,InputStream> encryptor)
Sets the function to be used to encrypt this stream.
|
void |
setFilters(COSBase filters)
set the filters to be applied to the stream.
|
void |
unDecode()
offload decoded/unfiltered data leaving the COSStrem in its filtered state and reducing memory footprint
|
addAll, asUnmodifiableDictionary, clear, containsKey, containsKey, duplicate, entrySet, getBoolean, getBoolean, getBoolean, getCOSArray, getCOSName, getCOSName, getDate, getDate, getDate, getDate, getDictionaryObject, getDictionaryObject, getDictionaryObject, getDictionaryObject, getDictionaryObject, getDictionaryObject, getEmbeddedDate, getEmbeddedDate, getEmbeddedDate, getEmbeddedDate, getEmbeddedInt, getEmbeddedInt, getEmbeddedInt, getEmbeddedInt, getEmbeddedString, getEmbeddedString, getEmbeddedString, getEmbeddedString, getFlag, getFloat, getFloat, getFloat, getFloat, getInt, getInt, getInt, getInt, getInt, getInt, getItem, getItem, getItem, getKeyForValue, getLong, getLong, getLong, getLong, getNameAsString, getNameAsString, getNameAsString, getNameAsString, getString, getString, getString, getString, getValues, keySet, merge, mergeWithoutOverwriting, putIfAbsent, putIfAbsent, putIfAbsent, putIfAbsent, putIfAbsent, putIfAbsent, removeItem, removeItems, setBoolean, setBoolean, setDate, setDate, setEmbeddedDate, setEmbeddedDate, setEmbeddedInt, setEmbeddedInt, setEmbeddedString, setEmbeddedString, setFlag, setFloat, setFloat, setInt, setInt, setItem, setItem, setItem, setItem, setLong, setLong, setName, setName, setString, setString, size, toStringgetCOSObject, hasId, id, idIfAbsentpublic COSStream()
public COSStream(COSDictionary dictionary)
dictionary - The dictionary that is associated with this stream.public COSStream(COSDictionary dictionary, org.sejda.io.SeekableSource seekableSource, long startingPosition, long length)
SeekableSource.dictionary - The dictionary that is associated with this stream.seekableSource - the source where filtered data is read fromstartingPosition - starting position of the stream data in the SeekableSourcelength - the length of the stream datapublic final InputStream getFilteredStream() throws IOException
IOException - when encoding/decoding causes an exceptionprotected InputStream doGetFilteredStream() throws IOException
IOExceptionpublic org.sejda.io.SeekableSource getFilteredSource()
throws IOException
SeekableSource with all of the filters applied.IOException - when encoding/decoding causes an exceptionpublic long getFilteredLength()
throws IOException
IOExceptionpublic InputStream getUnfilteredStream() throws IOException
IOException - when encoding/decoding causes an exceptionpublic org.sejda.io.SeekableSource getUnfilteredSource()
throws IOException
SeekableSource with all of the filters applied.IOException - when encoding/decoding causes an exceptionpublic ByteBuffer getUnfilteredByteBuffer() throws IOException
ByteBuffer with all of the filters applied.IOException - when encoding/decoding causes an exceptionpublic long getUnfilteredLength()
throws IOException
IOExceptionpublic DecodeResult getDecodeResult() throws IOException
IOException - when encoding/decoding causes an exceptionpublic void accept(COSVisitor visitor) throws IOException
COSBaseaccept in class COSDictionaryIOExceptionpublic COSBase getFilters()
public boolean hasFilter(COSName filter)
filter - public void setEncryptor(Function<InputStream,InputStream> encryptor)
encryptor - public OutputStream createFilteredStream()
public OutputStream createFilteredStream(COSBase filters)
filters - COSArray or COSName of filters to be used.IOException - If the output stream could not be created.public void setFilters(COSBase filters) throws IOException
filters - The filters to set on this stream.IOException - If there is an error clearing the old filters.public boolean addCompression()
public boolean encryptable()
encryptable in interface Encryptablepublic void encryptable(boolean encryptable)
Encryptableencryptable in interface Encryptablepublic OutputStream createUnfilteredStream()
IOException - If there is an error creating the stream.public boolean isEmpty()
throws IOException
IOExceptionpublic String asTextString()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void unDecode()
public boolean indirectLength()
public void indirectLength(boolean indirectLength)
indirectLength - if the writer should write this stream length as indirectCopyright © 2020 sejda. All rights reserved.