Top Description Inners Fields Constructors Methods
org.apache.pdfbox.pdfparser

public Class PDFXrefStreamParser

extends BaseParser
Class Inheritance
Imports
java.io.IOException, java.util.Arrays, .Iterator, .NoSuchElementException, org.apache.pdfbox.cos.COSArray, .COSBase, .COSDocument, .COSInteger, .COSName, .COSStream, .COSObjectKey

This will parse a PDF 1.5 (or better) Xref stream and extract the xref information from the stream.
Author
Justin LeFebvre

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private PDFXrefStreamParser.ObjectNumbers
private final int[]
w

Inherited from org.apache.pdfbox.pdfparser.BaseParser:
AASCII_CRASCII_LFBDDEFdocumentEENDOBJ_STRINGENDSTREAM_STRINGJMMAX_LENGTH_LONGNORSsourceSTREAM_STRINGT

Constructor Summary

AccessConstructor and Description
public
PDFXrefStreamParser(COSStream
The stream to parse.
stream
,
COSDocument
The document for the current parsing.
document
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
private void
private void
public void
parse(XrefTrailerResolver
resolver to read the xref/trailer information
resolver
)

Parses through the unfiltered stream and populates the xrefTable HashMap.

private long
parseValue(byte[] data, int start, int length)

private void
readNextValue(byte[] value)

Inherited from org.apache.pdfbox.pdfparser.BaseParser:
getObjectKeyisClosingisClosingisDigitisDigitisEndOfNameisEOFisEOLisEOLisSpaceisSpaceisWhitespaceisWhitespaceparseCOSArrayparseCOSDictionaryparseCOSNameparseCOSStringparseDirObjectreadExpectedCharreadExpectedStringreadGenerationNumberreadIntreadLinereadLongreadObjectNumberreadStringreadStringreadStringNumberskipSpacesskipWhiteSpaces

Field Detail

objectNumbersback to summary
private PDFXrefStreamParser.ObjectNumbers objectNumbers
wback to summary
private final int[] w

Constructor Detail

PDFXrefStreamParserback to summary
public PDFXrefStreamParser(COSStream stream, COSDocument document) throws IOException

Constructor.

Parameters
stream:COSStream

The stream to parse.

document:COSDocument

The document for the current parsing.

Exceptions
IOException:
If there is an error initializing the stream.

Method Detail

closeback to summary
private void close() throws IOException
initParserValuesback to summary
private void initParserValues(COSStream stream) throws IOException
parseback to summary
public void parse(XrefTrailerResolver resolver) throws IOException

Parses through the unfiltered stream and populates the xrefTable HashMap.

Parameters
resolver:XrefTrailerResolver

resolver to read the xref/trailer information

Exceptions
IOException:
If there is an error while parsing the stream.
parseValueback to summary
private long parseValue(byte[] data, int start, int length)
readNextValueback to summary
private void readNextValue(byte[] value) throws IOException
org.apache.pdfbox.pdfparser back to summary

private Class PDFXrefStreamParser.ObjectNumbers

extends Object
implements Iterator<Long>
Class Inheritance
  • java.lang.Object
  • org.apache.pdfbox.pdfparser.PDFXrefStreamParser.ObjectNumbers
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private long
private long
private int
private final long[]
private final long[]

Constructor Summary

AccessConstructor and Description
private
ObjectNumbers(COSArray indexArray)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public Long
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentEndback to summary
private long currentEnd
currentNumberback to summary
private long currentNumber
currentRangeback to summary
private int currentRange
endback to summary
private final long[] end
startback to summary
private final long[] start

Constructor Detail

ObjectNumbersback to summary
private ObjectNumbers(COSArray indexArray) throws IOException

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public Long next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Long

the next element in the iteration

Annotations
@Override