org.icepdf.core.pobjects
Class Stream

java.lang.Object
  extended by org.icepdf.core.pobjects.Dictionary
      extended by org.icepdf.core.pobjects.Stream
Direct Known Subclasses:
Appearance, Form, ImageStream, ObjectStream, TilingPattern

public class Stream
extends Dictionary

The Stream class is responsible for decoding stream contents and returning either an images object or a byte array depending on the content. The Stream object worker method is decode which is responsible for decoding the content stream, which is if the first step of the rendering process. Once a Stream is decoded it is either returned as an image object or a byte array that is then processed further by the ContentParser.

Since:
1.0

Field Summary
static Name COLORSPACE_KEY
           
protected  boolean compressed
           
static Name CS_KEY
           
static Name DECODEPARAM_KEY
           
static Name F_KEY
           
static Name FILTER_KEY
           
static Name H_KEY
           
static Name HEIGHT_KEY
           
static Name I_KEY
           
static Name IM_KEY
           
static Name IMAGEMASK_KEY
           
static Name INDEXED_KEY
           
protected  Reference pObjectReference
           
protected  byte[] rawBytes
           
static Name W_KEY
           
static Name WIDTH_KEY
           
 
Fields inherited from class org.icepdf.core.pobjects.Dictionary
entries, FORM_TYPE_KEY, inited, isDeleted, isNew, LENGTH_KEY, library, SUBTYPE_KEY, TYPE_KEY
 
Constructor Summary
Stream(Library l, java.util.HashMap h, byte[] rawBytes)
           
Stream(Library l, java.util.HashMap h, SeekableInputConstrainedWrapper streamInputWrapper)
          Create a new instance of a Stream.
 
Method Summary
 java.io.ByteArrayInputStream getDecodedByteArrayInputStream()
          Gets the decoded Byte stream of the Stream object.
 byte[] getDecodedStreamBytes()
           
 byte[] getDecodedStreamBytes(int presize)
          This is similar to getDecodedStreamByteArray(), except that the returned byte[] is not necessarily exactly sized, and may be larger.
protected  java.util.List<java.lang.String> getFilterNames()
           
protected  java.util.List<java.lang.String> getNormalisedFilterNames()
           
 Reference getPObjectReference()
          Gets the parent PObject reference for this stream.
 byte[] getRawBytes()
           
protected  boolean isImageSubtype()
           
 boolean isRawBytesCompressed()
           
 void setPObjectReference(Reference reference)
          Sets the PObject referece for this stream.
 void setRawBytes(byte[] rawBytes)
           
 java.lang.String toString()
          Return a string description of the object.
 
Methods inherited from class org.icepdf.core.pobjects.Dictionary
getEntries, getFloat, getInt, getLibrary, getNumber, getObject, init, isDeleted, isNew, setDeleted, setNew
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WIDTH_KEY

public static final Name WIDTH_KEY

W_KEY

public static final Name W_KEY

HEIGHT_KEY

public static final Name HEIGHT_KEY

H_KEY

public static final Name H_KEY

IMAGEMASK_KEY

public static final Name IMAGEMASK_KEY

IM_KEY

public static final Name IM_KEY

COLORSPACE_KEY

public static final Name COLORSPACE_KEY

CS_KEY

public static final Name CS_KEY

DECODEPARAM_KEY

public static final Name DECODEPARAM_KEY

FILTER_KEY

public static final Name FILTER_KEY

F_KEY

public static final Name F_KEY

INDEXED_KEY

public static final Name INDEXED_KEY

I_KEY

public static final Name I_KEY

rawBytes

protected byte[] rawBytes

compressed

protected boolean compressed

pObjectReference

protected Reference pObjectReference
Constructor Detail

Stream

public Stream(Library l,
              java.util.HashMap h,
              SeekableInputConstrainedWrapper streamInputWrapper)
Create a new instance of a Stream.

Parameters:
l - library containing a hash of all document objects
h - HashMap of parameters specific to the Stream object.
streamInputWrapper - Accessor to stream byte data

Stream

public Stream(Library l,
              java.util.HashMap h,
              byte[] rawBytes)
Method Detail

setPObjectReference

public void setPObjectReference(Reference reference)
Sets the PObject referece for this stream. The reference number and generation is need by the encryption algorithm.

Overrides:
setPObjectReference in class Dictionary
Parameters:
reference - Reference used to identify this Dictionary in the PDF document.
See Also:
Dictionary.getPObjectReference()

getRawBytes

public byte[] getRawBytes()

setRawBytes

public void setRawBytes(byte[] rawBytes)

isRawBytesCompressed

public boolean isRawBytesCompressed()

getPObjectReference

public Reference getPObjectReference()
Gets the parent PObject reference for this stream.

Overrides:
getPObjectReference in class Dictionary
Returns:
Reference number of parent PObject.
See Also:
setPObjectReference(org.icepdf.core.pobjects.Reference)

isImageSubtype

protected boolean isImageSubtype()

getDecodedByteArrayInputStream

public java.io.ByteArrayInputStream getDecodedByteArrayInputStream()
Gets the decoded Byte stream of the Stream object.

Returns:
decoded Byte stream

getDecodedStreamBytes

public byte[] getDecodedStreamBytes()

getDecodedStreamBytes

public byte[] getDecodedStreamBytes(int presize)
This is similar to getDecodedStreamByteArray(), except that the returned byte[] is not necessarily exactly sized, and may be larger. Therefore the returned Integer gives the actual valid size

Parameters:
presize - potential size to associate with byte array.
Returns:
Object[] { byte[] data, Integer sizeActualData }

getFilterNames

protected java.util.List<java.lang.String> getFilterNames()

getNormalisedFilterNames

protected java.util.List<java.lang.String> getNormalisedFilterNames()

toString

public java.lang.String toString()
Return a string description of the object. Primarly used for debugging.

Overrides:
toString in class Dictionary
Returns:
dictionary values.