Top Fields Constructors Methods
org.apache.pdfbox.pdfparser

public Class PDFXRefStream

extends Object
Class Inheritance
Imports
java.io.IOException, .OutputStream, java.util.ArrayList, .Collections, .LinkedList, .List, .Set, .TreeSet, org.apache.pdfbox.cos.COSArray, .COSBase, .COSDictionary, .COSDocument, .COSInteger, .COSName, .COSStream, org.apache.pdfbox.pdfparser.xref.FreeXReference, .XReferenceEntry

Author
Alexander Funk

Field Summary

Modifier and TypeField and Description
private final Set<Long>
private long
private final COSStream
private final List<XReferenceEntry>

Constructor Summary

AccessConstructor and Description
public
PDFXRefStream(COSDocument
the COSDocmernt to be used to create a new COSStream
cosDocument
)

Create a fresh XRef stream like for a fresh file or an incremental update.

Method Summary

Modifier and TypeMethod and Description
public void
addEntry(XReferenceEntry
new entry to be added
entry
)

Add an new entry to the XRef stream.

public void
addTrailerInfo(COSDictionary
dictionary to be added as trailer info
trailerDict
)

Copy all Trailer Information to this file.

private List<Long>
public COSStream

Returns:

the XRef stream
getStream
()

Returns the stream of the XRef.

private int[]

Returns:

the length information
getWEntry
()

determines the minimal length required for all the lengths.

public void
setSize(long
size to bet set as stream size
streamSize
)

Set the size of the XRef stream.

private void
writeNumber(OutputStream os, long number, int bytes)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

objectNumbersback to summary
private final Set<Long> objectNumbers
sizeback to summary
private long size
streamback to summary
private final COSStream stream
streamDataback to summary
private final List<XReferenceEntry> streamData

Constructor Detail

PDFXRefStreamback to summary
public PDFXRefStream(COSDocument cosDocument)

Create a fresh XRef stream like for a fresh file or an incremental update.

Parameters
cosDocument:COSDocument

the COSDocmernt to be used to create a new COSStream

Method Detail

addEntryback to summary
public void addEntry(XReferenceEntry entry)

Add an new entry to the XRef stream.

Parameters
entry:XReferenceEntry

new entry to be added

addTrailerInfoback to summary
public void addTrailerInfo(COSDictionary trailerDict)

Copy all Trailer Information to this file.

Parameters
trailerDict:COSDictionary

dictionary to be added as trailer info

getIndexEntryback to summary
private List<Long> getIndexEntry()
getStreamback to summary
public COSStream getStream() throws IOException

Returns the stream of the XRef.

Returns:COSStream

the XRef stream

Exceptions
IOException:
if something went wrong
getWEntryback to summary
private int[] getWEntry()

determines the minimal length required for all the lengths.

Returns:int[]

the length information

setSizeback to summary
public void setSize(long streamSize)

Set the size of the XRef stream.

Parameters
streamSize:long

size to bet set as stream size

writeNumberback to summary
private void writeNumber(OutputStream os, long number, int bytes) throws IOException
writeStreamDataback to summary
private void writeStreamData(OutputStream os, int[] w) throws IOException