public static class PdfWriter.PdfBody
extends java.lang.Object
This class covers the third section of Chapter 5 in the 'Portable Document Format Reference Manual version 1.3' (page 55-60). It contains the body of a PDF document (section 5.14) and it can also generate a Cross-reference Table (section 5.15).
PdfWriter
,
PdfObject
,
PdfIndirectObject
Modifier and Type | Class and Description |
---|---|
(package private) static class |
PdfWriter.PdfBody.PdfCrossReference
PdfCrossReference is an entry in the PDF Cross-Reference table. |
Modifier and Type | Field and Description |
---|---|
private int |
currentObjNum |
private ByteBuffer |
index |
private int |
numObj |
private static int |
OBJSINSTREAM |
private int |
position
the current byte position in the body.
|
private int |
refnum |
private ByteBuffer |
streamObjects |
private PdfWriter |
writer |
private java.util.TreeSet |
xrefs
array containing the cross-reference table of the normal objects.
|
Constructor and Description |
---|
PdfWriter.PdfBody(PdfWriter writer)
Constructs a new
PdfBody . |
Modifier and Type | Method and Description |
---|---|
(package private) PdfIndirectObject |
add(PdfObject object)
Adds a
PdfObject to the body. |
(package private) PdfIndirectObject |
add(PdfObject object,
boolean inObjStm) |
(package private) PdfIndirectObject |
add(PdfObject object,
int refNumber) |
(package private) PdfIndirectObject |
add(PdfObject object,
int refNumber,
boolean inObjStm) |
(package private) PdfIndirectObject |
add(PdfObject object,
PdfIndirectReference ref)
Adds a
PdfObject to the body given an already existing
PdfIndirectReference. |
(package private) PdfIndirectObject |
add(PdfObject object,
PdfIndirectReference ref,
boolean inObjStm) |
private PdfWriter.PdfBody.PdfCrossReference |
addToObjStm(PdfObject obj,
int nObj) |
private void |
flushObjStm() |
(package private) int |
getIndirectReferenceNumber() |
(package private) PdfIndirectReference |
getPdfIndirectReference()
Gets a PdfIndirectReference for an object that will be created in the future.
|
(package private) int |
offset()
Returns the offset of the Cross-Reference table.
|
(package private) void |
setRefnum(int refnum) |
(package private) int |
size()
Returns the total number of objects contained in the CrossReferenceTable of this
Body . |
(package private) void |
writeCrossReferenceTable(java.io.OutputStream os,
PdfIndirectReference root,
PdfIndirectReference info,
PdfIndirectReference encryption,
PdfObject fileID,
int prevxref)
Returns the CrossReferenceTable of the
Body . |
private static final int OBJSINSTREAM
private java.util.TreeSet xrefs
private int refnum
private int position
private PdfWriter writer
private ByteBuffer index
private ByteBuffer streamObjects
private int currentObjNum
private int numObj
PdfWriter.PdfBody(PdfWriter writer)
PdfBody
.writer
- void setRefnum(int refnum)
private PdfWriter.PdfBody.PdfCrossReference addToObjStm(PdfObject obj, int nObj) throws java.io.IOException
java.io.IOException
private void flushObjStm() throws java.io.IOException
java.io.IOException
PdfIndirectObject add(PdfObject object) throws java.io.IOException
PdfObject
to the body.
This methods creates a PdfIndirectObject
with a
certain number, containing the given PdfObject
.
It also adds a PdfCrossReference
for this object
to an ArrayList
that will be used to build the
Cross-reference Table.
object
- a PdfObject
PdfIndirectObject
java.io.IOException
PdfIndirectObject add(PdfObject object, boolean inObjStm) throws java.io.IOException
java.io.IOException
PdfIndirectReference getPdfIndirectReference()
int getIndirectReferenceNumber()
PdfIndirectObject add(PdfObject object, PdfIndirectReference ref) throws java.io.IOException
PdfObject
to the body given an already existing
PdfIndirectReference.
This methods creates a PdfIndirectObject
with the number given by
ref
, containing the given PdfObject
.
It also adds a PdfCrossReference
for this object
to an ArrayList
that will be used to build the
Cross-reference Table.
object
- a PdfObject
ref
- a PdfIndirectReference
PdfIndirectObject
java.io.IOException
PdfIndirectObject add(PdfObject object, PdfIndirectReference ref, boolean inObjStm) throws java.io.IOException
java.io.IOException
PdfIndirectObject add(PdfObject object, int refNumber) throws java.io.IOException
java.io.IOException
PdfIndirectObject add(PdfObject object, int refNumber, boolean inObjStm) throws java.io.IOException
java.io.IOException
int offset()
int size()
Body
.void writeCrossReferenceTable(java.io.OutputStream os, PdfIndirectReference root, PdfIndirectReference info, PdfIndirectReference encryption, PdfObject fileID, int prevxref) throws java.io.IOException
Body
.os
- root
- info
- encryption
- fileID
- prevxref
- java.io.IOException