public class PDStream extends Object implements COSObjectable
Constructor and Description |
---|
PDStream(COSDocument document)
Creates a new PDStream object.
|
PDStream(COSStream str)
Creates a PDStream which wraps the given COSStream.
|
PDStream(PDDocument document)
Creates a new PDStream object.
|
PDStream(PDDocument doc,
InputStream input)
Constructor.
|
PDStream(PDDocument doc,
InputStream input,
COSArray filters)
Constructor.
|
PDStream(PDDocument doc,
InputStream input,
COSName filter)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addCompression()
Deprecated.
This method is inefficient. To copying an existing InputStream, use
PDStream(PDDocument, InputStream, COSName) instead, with
COSName.FLATE_DECODE as the final argument.
Otherwise, to write new compressed data, use createOutputStream(COSName) ,
with COSName.FLATE_DECODE as the argument. |
COSInputStream |
createInputStream()
This will get a stream that can be read from.
|
InputStream |
createInputStream(List<String> stopFilters)
This will get a stream with some filters applied but not others.
|
OutputStream |
createOutputStream()
This will get a stream that can be written to.
|
OutputStream |
createOutputStream(COSName filter)
This will get a stream that can be written to, with the given filter.
|
COSStream |
getCOSObject()
Get the cos stream associated with this object.
|
int |
getDecodedStreamLength()
Get the decoded stream length.
|
List<Object> |
getDecodeParms()
Get the list of decode parameters.
|
PDFileSpecification |
getFile()
This will get the file specification for this stream.
|
List<Object> |
getFileDecodeParams()
Get the list of decode parameters.
|
List<String> |
getFileFilters()
This will get the list of filters that are associated with this stream.
|
List<COSName> |
getFilters()
This will get the list of filters that are associated with this stream.
|
int |
getLength()
This will get the length of the filtered/compressed stream.
|
PDMetadata |
getMetadata()
Get the metadata that is part of the document catalog.
|
COSStream |
getStream()
Deprecated.
use
getCOSObject() |
void |
setDecodedStreamLength(int decodedStreamLength)
Set the decoded stream length.
|
void |
setDecodeParms(List<?> decodeParams)
This will set the list of decode parameterss.
|
void |
setFile(PDFileSpecification f)
Set the file specification.
|
void |
setFileDecodeParams(List<?> decodeParams)
This will set the list of decode params.
|
void |
setFileFilters(List<String> filters)
This will set the filters that are part of this stream.
|
void |
setFilters(List<COSName> filters)
This will set the filters that are part of this stream.
|
void |
setMetadata(PDMetadata meta)
Set the metadata for this object.
|
byte[] |
toByteArray()
This will copy the stream into a byte array.
|
public PDStream(PDDocument document)
document
- The document that the stream will be part of.public PDStream(COSDocument document)
document
- The document that the stream will be part of.public PDStream(COSStream str)
str
- The stream parameter.public PDStream(PDDocument doc, InputStream input) throws IOException
doc
- The document that will hold the stream.input
- The stream parameter.IOException
- If there is an error creating the stream in the document.public PDStream(PDDocument doc, InputStream input, COSName filter) throws IOException
doc
- The document that will hold the stream.input
- The stream parameter.filter
- Filter to apply to the stream.IOException
- If there is an error creating the stream in the document.public PDStream(PDDocument doc, InputStream input, COSArray filters) throws IOException
doc
- The document that will hold the stream.input
- The stream parameter.filters
- Filters to apply to the stream.IOException
- If there is an error creating the stream in the document.@Deprecated public void addCompression()
PDStream(PDDocument, InputStream, COSName)
instead, with
COSName.FLATE_DECODE as the final argument.
Otherwise, to write new compressed data, use createOutputStream(COSName)
,
with COSName.FLATE_DECODE as the argument.public COSStream getCOSObject()
getCOSObject
in interface COSObjectable
public OutputStream createOutputStream() throws IOException
IOException
- If an IO error occurs during writing.public OutputStream createOutputStream(COSName filter) throws IOException
filter
- the filter to be used.IOException
- If an IO error occurs during writing.public COSInputStream createInputStream() throws IOException
IOException
- If an IO error occurs during reading.public InputStream createInputStream(List<String> stopFilters) throws IOException
stopFilters
- A list of filters to stop decoding at.IOException
- If there is an error processing the stream.@Deprecated public COSStream getStream()
getCOSObject()
public int getLength()
public List<COSName> getFilters()
public void setFilters(List<COSName> filters)
filters
- The filters that are part of this stream.public List<Object> getDecodeParms() throws IOException
IOException
- if there is an error retrieving the parameters.public void setDecodeParms(List<?> decodeParams)
decodeParams
- The list of decode parameterss.public PDFileSpecification getFile() throws IOException
IOException
- If there is an error creating the file spec.public void setFile(PDFileSpecification f)
f
- The file specification.public List<String> getFileFilters()
public void setFileFilters(List<String> filters)
filters
- The filters that are part of this stream.public List<Object> getFileDecodeParams() throws IOException
IOException
- if there is an error retrieving the parameters.public void setFileDecodeParams(List<?> decodeParams)
decodeParams
- The list of decode params.public byte[] toByteArray() throws IOException
IOException
- if an I/O error occurs.public PDMetadata getMetadata()
IllegalStateException
- if the value of the metadata entry is different from a stream
or nullpublic void setMetadata(PDMetadata meta)
meta
- The meta data for this object.public int getDecodedStreamLength()
public void setDecodedStreamLength(int decodedStreamLength)
decodedStreamLength
- the decoded stream lengthCopyright © 2002–2016 The Apache Software Foundation. All rights reserved.