Home » pdfbox-1.1.0-src » org.apache.pdfbox.pdmodel.common » [javadoc | source]
org.apache.pdfbox.pdmodel.common
public class: PDStream [javadoc | source]
java.lang.Object
   org.apache.pdfbox.pdmodel.common.PDStream

All Implemented Interfaces:
    COSObjectable

Direct Known Subclasses:
    PDEmbeddedFile, PDObjectStream, PDMemoryStream, PDMetadata

A PDStream represents a stream in a PDF document. Streams are tied to a single PDF document.
Constructor:
 protected PDStream() 
 public PDStream(PDDocument document) 
    This will create a new PDStream object.
    Parameters:
    document - The document that the stream will be part of.
 public PDStream(COSStream str) 
    Constructor.
    Parameters:
    str - The stream parameter.
 public PDStream(PDDocument doc,
    InputStream str) throws IOException 
    Constructor. Reads all data from the input stream and embeds it into the document, this will close the InputStream.
    Parameters:
    doc - The document that will hold the stream.
    str - The stream parameter.
    Throws:
    IOException - If there is an error creating the stream in the document.
 public PDStream(PDDocument doc,
    InputStream str,
    boolean filtered) throws IOException 
    Constructor. Reads all data from the input stream and embeds it into the document, this will close the InputStream.
    Parameters:
    doc - The document that will hold the stream.
    str - The stream parameter.
    filtered - True if the stream already has a filter applied.
    Throws:
    IOException - If there is an error creating the stream in the document.
Method from org.apache.pdfbox.pdmodel.common.PDStream Summary:
addCompression,   createFromCOS,   createInputStream,   createOutputStream,   getByteArray,   getCOSObject,   getDecodeParms,   getDecodedStreamLength,   getFile,   getFileDecodeParams,   getFileFilters,   getFilters,   getInputStreamAsString,   getLength,   getMetadata,   getPartiallyFilteredStream,   getStream,   setDecodeParms,   setDecodedStreamLength,   setFile,   setFileDecodeParams,   setFileFilters,   setFilters,   setMetadata
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.pdfbox.pdmodel.common.PDStream Detail:
 public  void addCompression() 
    If there are not compression filters on the current stream then this will add a compression filter, flate compression for example.
 public static PDStream createFromCOS(COSBase base) throws IOException 
    Create a pd stream from either a regular COSStream on a COSArray of cos streams.
 public InputStream createInputStream() throws IOException 
    This will get a stream that can be read from.
 public OutputStream createOutputStream() throws IOException 
    This will get a stream that can be written to.
 public byte[] getByteArray() throws IOException 
    This will copy the stream into a byte array.
 public COSBase getCOSObject() 
    Convert this standard java object to a COS object.
 public List getDecodeParms() throws IOException 
    Get the list of decode parameters. Each entry in the list will refer to an entry in the filters list.
 public int getDecodedStreamLength() 
    Get the decoded stream length.
 public PDFileSpecification getFile() throws IOException 
    This will get the file specification for this stream. This is only required for external files.
 public List getFileDecodeParams() throws IOException 
    Get the list of decode parameters. Each entry in the list will refer to an entry in the filters list.
 public List getFileFilters() 
    This will get the list of filters that are associated with this stream. Or null if there are none.
 public List getFilters() 
    This will get the list of filters that are associated with this stream. Or null if there are none.
 public String getInputStreamAsString() throws IOException 
    A convenience method to get this stream as a string. Uses the default system encoding.
 public int getLength() 
    This will get the length of the filtered/compressed stream. This is readonly in the PD Model and will be managed by this class.
 public PDMetadata getMetadata() 
    Get the metadata that is part of the document catalog. This will return null if there is no meta data for this object.
 public InputStream getPartiallyFilteredStream(List stopFilters) throws IOException 
    This will get a stream with some filters applied but not others. This is useful when doing images, ie filters = [flate,dct], we want to remove flate but leave dct
 public COSStream getStream() 
    Get the cos stream associated with this object.
 public  void setDecodeParms(List decodeParams) 
    This will set the list of decode parameterss.
 public  void setDecodedStreamLength(int decodedStreamLength) 
    Set the decoded stream length.
 public  void setFile(PDFileSpecification f) 
    Set the file specification.
 public  void setFileDecodeParams(List decodeParams) 
    This will set the list of decode params.
 public  void setFileFilters(List filters) 
    This will set the filters that are part of this stream.
 public  void setFilters(List filters) 
    This will set the filters that are part of this stream.
 public  void setMetadata(PDMetadata meta) 
    Set the metadata for this object. This can be null.