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

## edu.harvard.hul.ois.jhove.module.pdf
Class CrossRefStream

    java.lang.Object
      edu.harvard.hul.ois.jhove.module.pdf.CrossRefStream

    public class CrossRefStream

extends java.lang.Object

This class implements the Cross-Reference Stream, an alternative to the Cross-Reference Table starting in PDF 1.4. A cross-reference stream is identified by a startxref keyword, as opposed to the xref keyword which identifies the old-style cross-reference table. JHOVE supports only FlateDecode as a filter for cross-reference streams. This is consistent with the implementation limitation described in Appendix H of the PDF manual for Acrobat 6 and earlier.

Author:
  Gary McGath

Constructor Summary
`CrossRefStream(PdfStream xstrm)` Constructor.

Method Summary
`int` | `getContentStreamIndex()` Returns the content stream index of the last object read.
`int` | `getContentStreamObjNum()` Returns the object number of the content stream in which this object is stored.
`int` | `getFreeCount()` Returns the number of free objects detected.
`int` | `getNumObjects()` Returns the total object count.
`int` | `getObjNum()` Returns number of the last object read by `readNextObject ()`.
`int` | `getOffset()` Returns the offset of the last object object read.
`long` | `getPrevXref()` Returns the offset of the previous cross-reference stream, or -1 if none is specified.
`void` | `initRead(java.io.RandomAccessFile raf)` Prepares for reading the Stream.
`boolean` | `isObjCompressed()` Returns `true` if the last object read by `readNextObject ()` is a compressed object.
`boolean` | `isValid()` Returns `true` if the PdfStream object meets the requirements of a cross-reference stream.
`boolean` | `readNextObject()` Reads the next object in the stream.

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

Constructor Detail

### CrossRefStream

    public CrossRefStream(PdfStream xstrm)

  Constructor.

  Parameters:
    `xstrm` - PdfStream object which contains a presumed cross-reference stream.

Method Detail

### isValid

    public boolean isValid()

  Returns `true` if the PdfStream object meets the requirements of a cross-reference stream. Also extracts information from the dictionary for subsequent processing.

### initRead

    public void initRead(java.io.RandomAccessFile raf)
                  throws java.io.IOException,
                         PdfException

  Prepares for reading the Stream. If the filter List includes one which we don't support, throws a PdfException.

  Throws:
    `java.io.IOException`
    `PdfException`

### readNextObject

    public boolean readNextObject()
                           throws java.io.IOException

  Reads the next object in the stream. After calling `readObject`, it is possible to call accessors to get information about the object. For the moment, we punt on the question of how to deal with Object Streams. Free objects are skipped over while being counted. After `readNextObject() returns `false`, the caller may call `getFreeCount()` to determine the number of free objects.

  `
  Returns:
    `true` if there is an object, `false` if no more objects are available.
  Throws:
    `java.io.IOException`

### getObjNum

    public int getObjNum()

  Returns number of the last object read by `readNextObject ()`. Do not call if `readNextObject ()` returns `false`.

### isObjCompressed

    public boolean isObjCompressed()

  Returns `true` if the last object read by `readNextObject ()` is a compressed object. Do not call if `readNextObject ()` returns `false`.

### getFreeCount

    public int getFreeCount()

  Returns the number of free objects detected. This may be called after `readNextObject` returns `false`, signifying that all the objects have been read and all the free objects counted.

### getNumObjects

    public int getNumObjects()

  Returns the total object count.

### getOffset

    public int getOffset()

  Returns the offset of the last object object read. This is meaningful only if the last object read was type 1 (uncompressed).

### getContentStreamObjNum

    public int getContentStreamObjNum()

  Returns the object number of the content stream in which this object is stored. This is nmeaningful only if the last object read was type 2 (compressed in content stream).

### getPrevXref

    public long getPrevXref()

  Returns the offset of the previous cross-reference stream, or -1 if none is specified.

### getContentStreamIndex

    public int getContentStreamIndex()

  Returns the content stream index of the last object read. This is nmeaningful only if the last object read was type 2 (compressed in content stream).

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