Top Description Fields Constructors Methods
org.apache.pdfbox.jbig2

pack-priv Class JBIG2Page

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.ArrayList, .Map, .Set, .TreeMap, org.apache.pdfbox.jbig2.err.IntegerMaxValueException, .InvalidHeaderValueException, .JBIG2Exception, org.apache.pdfbox.jbig2.image.Bitmaps, org.apache.pdfbox.jbig2.segments.EndOfStripe, .PageInformation, .RegionSegmentInformation, org.apache.pdfbox.jbig2.util.CombinationOperator

This class represents a JBIG2 page.

Field Summary

Modifier and TypeField and Description
private final JBIG2Document
private int
private int
private Bitmap
pageBitmap

The page bitmap that represents the page buffer

private final int
pageNumber

Note

page number != segmentList index

private int
private int
private final Map<Integer, SegmentHeader>
segments

This list contains all segments of this page, sorted by segment number in ascending order.

Constructor Summary

AccessConstructor and Description
protected
JBIG2Page(JBIG2Document document, int pageNumber)

Method Summary

Modifier and TypeMethod and Description
protected void
add(SegmentHeader
- The segment to be added.
segment
)

Adds a SegmentHeader into the page's segments map.

protected void
clearPageData()

Reset memory-critical parts of page.

private void
clearSegmentData()

Resets the memory-critical segments to force on-demand-decoding and to avoid holding the segments' bitmap too long.

private ArrayList<SegmentData>
private void
composePageBitmap()

This method composes the segments' bitmaps to a page and stores the page as a Bitmap

private int

Returns:

Amount of regions.
countRegions
()

This method counts the regions segments.

private void
private void
createPage(PageInformation pageInformation)

private void
private boolean
fitsPage(PageInformation pageInformation, final Bitmap regionBitmap)

Check if we have only one region that forms the complete page.

protected Bitmap

Returns:

pageBitmap - The result of decoding a page
getBitmap
()

This method returns the decoded bitmap if present.

private CombinationOperator

Returns:

the new combination operator
getCombinationOperator
(PageInformation
- PageInformation object
pi
,
CombinationOperator
- The combination operator, specified by actual segment
newOperator
)

This method checks and sets, which combination operator shall be used.

protected int

Returns:

The final height of the page.
getHeight
()

Returns the final height of the page.

protected SegmentHeader

Returns:

The associated PageInformation segment or null if not available.
getPageInformationSegment
()

Returns the associated page information segment.

protected int
protected int
public SegmentHeader

Returns:

The retrieved SegmentHeader or null if not available.
getSegment
(int
- Segment number of the segment to search.
number
)

This method searches for a segment specified by its number.

protected int
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

documentback to summary
private final JBIG2Document document
finalHeightback to summary
private int finalHeight
finalWidthback to summary
private int finalWidth
pageBitmapback to summary
private Bitmap pageBitmap

The page bitmap that represents the page buffer

pageNumberback to summary
private final int pageNumber

Note

page number != segmentList index

resolutionXback to summary
private int resolutionX
resolutionYback to summary
private int resolutionY
segmentsback to summary
private final Map<Integer, SegmentHeader> segments

This list contains all segments of this page, sorted by segment number in ascending order.

Constructor Detail

JBIG2Pageback to summary
protected JBIG2Page(JBIG2Document document, int pageNumber)

Method Detail

addback to summary
protected void add(SegmentHeader segment)

Adds a SegmentHeader into the page's segments map.

Parameters
segment:SegmentHeader

- The segment to be added.

clearPageDataback to summary
protected void clearPageData()

Reset memory-critical parts of page.

clearSegmentDataback to summary
private void clearSegmentData()

Resets the memory-critical segments to force on-demand-decoding and to avoid holding the segments' bitmap too long.

collectPageStripesback to summary
private ArrayList<SegmentData> collectPageStripes()
composePageBitmapback to summary
private void composePageBitmap() throws IOException, JBIG2Exception

This method composes the segments' bitmaps to a page and stores the page as a Bitmap

countRegionsback to summary
private int countRegions()

This method counts the regions segments. If there is only one region, the bitmap of this segment is equal to the page bitmap and blitting is not necessary.

Returns:int

Amount of regions.

createNormalPageback to summary
private void createNormalPage(PageInformation pageInformation) throws IOException, IntegerMaxValueException, InvalidHeaderValueException
createPageback to summary
private void createPage(PageInformation pageInformation) throws IOException, IntegerMaxValueException, InvalidHeaderValueException
createStripedPageback to summary
private void createStripedPage(PageInformation pageInformation) throws IOException, IntegerMaxValueException, InvalidHeaderValueException
fitsPageback to summary
private boolean fitsPage(PageInformation pageInformation, final Bitmap regionBitmap)

Check if we have only one region that forms the complete page. If the dimension equals the page's dimension set the region's bitmap as the page's bitmap. Otherwise we have to blit the smaller region's bitmap into the page's bitmap (see Issue 6).

getBitmapback to summary
protected Bitmap getBitmap() throws JBIG2Exception, IOException

This method returns the decoded bitmap if present. Otherwise the page bitmap will be composed before returning the result.

Returns:Bitmap

pageBitmap - The result of decoding a page

getCombinationOperatorback to summary
private CombinationOperator getCombinationOperator(PageInformation pi, CombinationOperator newOperator)

This method checks and sets, which combination operator shall be used.

Parameters
pi:PageInformation

- PageInformation object

newOperator:CombinationOperator

- The combination operator, specified by actual segment

Returns:CombinationOperator

the new combination operator

getHeightback to summary
protected int getHeight() throws IOException, JBIG2Exception

Returns the final height of the page.

Returns:int

The final height of the page.

getPageInformationSegmentback to summary
protected SegmentHeader getPageInformationSegment()

Returns the associated page information segment.

Returns:SegmentHeader

The associated PageInformation segment or null if not available.

getResolutionXback to summary
protected int getResolutionX()
getResolutionYback to summary
protected int getResolutionY()
getSegmentback to summary
public SegmentHeader getSegment(int number)

This method searches for a segment specified by its number.

Parameters
number:int

- Segment number of the segment to search.

Returns:SegmentHeader

The retrieved SegmentHeader or null if not available.

getWidthback to summary
protected int getWidth()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override