: Class PjStream

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.etymon.pj.object
Class PjStream

    java.lang.Object
      |
      +--com.etymon.pj.object.BaseObject
            |
            +--com.etymon.pj.object.PjObject
                  |
                  +--com.etymon.pj.object.PjStream

All Implemented Interfaces:
  java.lang.Cloneable

public class PjStream
extends PjObject

A representation of the PDF stream type.

Field Summary
`protected PjStreamDictionary` | `_d`
`protected byte[]` | `_s`

Constructor Summary
`PjStream(byte[] s)` Creates a stream as a wrapper around a byte array.
`PjStream(PjStreamDictionary d, byte[] s)` Creates a stream as a wrapper around a PjStreamDictionary and byte array.

Method Summary
`PjStream` | `ascii85Decode()` Decode this stream if it is compressed with the Ascii85 algorithm.
`static byte[]` | `ascii85Decode(byte[] src)`
`static byte[]` | `ascii85Encode(byte[] src)`
`java.lang.Object` | `clone()` Returns a deep copy of this object.
`PjStream` | `flateCompress()` Compress this stream with the Flate algorithm if it is not already compressed.
`PjStream` | `flateDecompress()` Decompresses this stream if it is compressed with the Flate algorithm.
`byte[]` | `getBuffer()` Returns the byte array used in the representation of this stream.
`PjStreamDictionary` | `getStreamDictionary()` Returns the PjStreamDictionary used in the representation of this stream.
`void` | `renumber(java.util.Hashtable map)` Renumbers object references within this object.
`void` | `setLength()` Sets the Length field in the stream dictionary to accurately reflect the length of the stream.
`long` | `writePdf(java.io.OutputStream os)` Writes this PDF stream to a stream in PDF format.

Methods inherited from class com.etymon.pj.object.BaseObject
`toString, write, write, write, writeln`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### _d

    protected PjStreamDictionary _d

### _s

    protected byte[] _s

Constructor Detail

### PjStream

    public PjStream(byte[] s)

  Creates a stream as a wrapper around a byte array.
  Parameters:
    `s` - the byte array to use for this stream.

### PjStream

    public PjStream(PjStreamDictionary d,
                    byte[] s)

  Creates a stream as a wrapper around a PjStreamDictionary and byte array.
  Parameters:
    `d` - the dictionary to use for this stream.
    `s` - the byte array to use for this stream.

Method Detail

### getStreamDictionary

    public PjStreamDictionary getStreamDictionary()

  Returns the PjStreamDictionary used in the representation of this stream.
  Returns:
    the PjStreamDictionary used in the representation of this stream.

### getBuffer

    public byte[] getBuffer()

  Returns the byte array used in the representation of this stream.
  Returns:
    the byte array used in the representation of this stream.

### flateDecompress

    public PjStream flateDecompress()
                             throws InvalidPdfObjectException

  Decompresses this stream if it is compressed with the Flate algorithm.
  Returns:
    a cloned, uncompressed version of this stream; or this stream if it is not marked as being compressed with Flate.
  Throws:
    `InvalidPdfObjectException` - if an invalid object type is encountered.

### flateCompress

    public PjStream flateCompress()
                           throws InvalidPdfObjectException

  Compress this stream with the Flate algorithm if it is not already compressed.
  Returns:
    a cloned, compressed version of this stream; or this stream if it is already compressed.
  Throws:
    `InvalidPdfObjectException` - if an invalid object type is encountered.

### setLength

    public void setLength()

  Sets the Length field in the stream dictionary to accurately reflect the length of the stream. It is not normally necessary to call this method, because it gets called implicitly by methods that output the object in PDF format.

### writePdf

    public long writePdf(java.io.OutputStream os)
                  throws java.io.IOException

  Writes this PDF stream to a stream in PDF format.
  Overrides:
    `writePdf` in class `BaseObject`
  Parameters:
    `os` - the stream to write to.
  Returns:
    the number of bytes written.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Returns a deep copy of this object.
  Overrides:
    `clone` in class `BaseObject`
  Returns:
    a deep copy of this object.
  Throws:
    `java.lang.CloneNotSupportedException` - if the instance can not be cloned.

### renumber

    public void renumber(java.util.Hashtable map)

  Renumbers object references within this object. This method calls itself recursively to comprehensively renumber all objects contained within this object.
  Overrides:
    `renumber` in class `PjObject`
  Parameters:
    `map` - the table of object number mappings. Each object number is looked up by key in the hash table, and the associated value is assigned as the new object number. The map hash table should consist of PjNumber keys and PjReference values.

### ascii85Decode

    public PjStream ascii85Decode()
                           throws InvalidPdfObjectException

  Decode this stream if it is compressed with the Ascii85 algorithm.
  Returns:
    a cloned, unencoded version of this stream; or this stream if it is not marked as being compressed with Ascii85.
  Throws:
    `InvalidPdfObjectException` - if an invalid object type is encountered.

### ascii85Encode

    public static byte[] ascii85Encode(byte[] src)

### ascii85Decode

    public static byte[] ascii85Decode(byte[] src)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD