public class COSStream extends COSDictionary implements Closeable
items| Constructor and Description |
|---|
COSStream()
Creates a new stream with an empty dictionary.
|
COSStream(org.apache.pdfbox.io.RandomAccessStreamCache streamCache)
Creates a new stream with an empty dictionary.
|
COSStream(org.apache.pdfbox.io.RandomAccessStreamCache streamCache,
org.apache.pdfbox.io.RandomAccessReadView randomAccessReadView)
Creates a new stream with an empty dictionary.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(ICOSVisitor visitor)
visitor pattern double dispatch method.
|
void |
close()
Called by PDFBox when the PDDocument is closed, this closes the stream and removes the data.
|
COSInputStream |
createInputStream()
Returns a new InputStream which reads the decoded stream data.
|
COSInputStream |
createInputStream(DecodeOptions options) |
OutputStream |
createOutputStream()
Returns a new OutputStream for writing stream data, using the current filters.
|
OutputStream |
createOutputStream(COSBase filters)
Returns a new OutputStream for writing stream data, using and the given filters.
|
InputStream |
createRawInputStream()
Returns a new InputStream which reads the encoded PDF stream data.
|
OutputStream |
createRawOutputStream()
Returns a new OutputStream for writing encoded PDF data.
|
org.apache.pdfbox.io.RandomAccessRead |
createView()
Returns a new RandomAccessRead which reads the decoded stream data.
|
COSBase |
getFilters()
This will return the filters to apply to the byte stream.
|
long |
getLength()
Returns the length of the encoded stream.
|
boolean |
hasData()
Indicates whether the stream contains any data or not.
|
String |
toTextString()
Returns the contents of the stream as a PDF "text string".
|
addAll, asUnmodifiableDictionary, clear, containsKey, containsKey, containsValue, entrySet, forEach, getBoolean, getBoolean, getBoolean, getCOSArray, getCOSDictionary, getCOSDictionary, getCOSName, getCOSName, getCOSObject, getCOSStream, getDate, getDate, getDate, getDate, getDictionaryObject, getDictionaryObject, getDictionaryObject, getEmbeddedDate, getEmbeddedDate, getEmbeddedInt, getEmbeddedInt, getEmbeddedString, getEmbeddedString, getFlag, getFloat, getFloat, getFloat, getFloat, getIndirectObjectKeys, getInt, getInt, getInt, getInt, getInt, getInt, getItem, getItem, getItem, getKeyForValue, getLong, getLong, getLong, getLong, getNameAsString, getNameAsString, getNameAsString, getNameAsString, getObjectFromPath, getString, getString, getString, getString, getUpdateState, getValues, keySet, removeItem, setBoolean, setBoolean, setDate, setDate, setEmbeddedDate, setEmbeddedInt, setEmbeddedString, setFlag, setFloat, setFloat, setInt, setInt, setItem, setItem, setItem, setItem, setLong, setLong, setName, setName, setString, setString, size, toStringgetCOSObject, getKey, isDirect, setDirect, setKeyclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisNeedToBeUpdated, setNeedToBeUpdated, toIncrementgetCOSObjectpublic COSStream()
Try to avoid using this constructor because it creates a new scratch file in memory. Instead,
use document.getDocument().createCOSStream() which will
use the existing scratch file (in memory or in temp file) of the document.
public COSStream(org.apache.pdfbox.io.RandomAccessStreamCache streamCache)
streamCache - Stream cache for writing stream data.public COSStream(org.apache.pdfbox.io.RandomAccessStreamCache streamCache,
org.apache.pdfbox.io.RandomAccessReadView randomAccessReadView)
throws IOException
streamCache - Stream cache for writing stream data.randomAccessReadView - source for the data to be readIOException - if the length of the random access view isn't availablepublic InputStream createRawInputStream() throws IOException
IOException - If the stream could not be read.public COSInputStream createInputStream() throws IOException
IOException - If the stream could not be read.public COSInputStream createInputStream(DecodeOptions options) throws IOException
IOExceptionpublic org.apache.pdfbox.io.RandomAccessRead createView()
throws IOException
IOException - If the stream could not be read.public OutputStream createOutputStream() throws IOException
IOException - If the output stream could not be created.public OutputStream createOutputStream(COSBase filters) throws IOException
filters - COSArray or COSName of filters to be used.IOException - If the output stream could not be created.public OutputStream createRawOutputStream() throws IOException
IOException - If the output stream could not be created.public long getLength()
public COSBase getFilters()
public String toTextString()
public void accept(ICOSVisitor visitor) throws IOException
COSDictionaryaccept in class COSDictionaryvisitor - The object to notify when visiting this object.IOException - If there is an error visiting this object.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException - if something went wrong when closing the streampublic boolean hasData()
Copyright © 2002–2022 The Apache Software Foundation. All rights reserved.