Class JBIG2Document
java.lang.Object
org.apache.pdfbox.jbig2.JBIG2Document
This class represents the document structure with its pages and global segments.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intAccording to D.4.3 - Number of pages field (4 bytes).private booleanAccording to D.4.2 - Bit 1
trueif amount of pages is unknown, amount of pages field is not presentfalseif there is a field in the file header where the amount of pages can be readprivate int[]ID string in file header, see ISO/IEC 14492:2001, D.4.1private shortThe length of the file header if existsprivate booleanDefines whether extended Template is used.private JBIG2GlobalsHolds a load of segments, that aren't associated with a page.private shortAccording to D.4.2 - File header bit 0This map contains all pages of this document.static final intstatic final intprivate final SubInputStreamThis is the source data stream wrapped into aSubInputStream. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJBIG2Document(ImageInputStream input) protectedJBIG2Document(ImageInputStream input, JBIG2Globals globals) -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddetermineRandomDataOffsets(List<SegmentHeader> segments, long offset) Determines the start of the data parts and sets the offset.protected intRetrieves the amount of pages in this JBIG2 document.(package private) SegmentHeadergetGlobalSegment(int segmentNr) Retrieves the segment with the given segment number considering only segments that aren't associated with a page.protected JBIG2Globalsprotected JBIG2PagegetPage(int pageNumber) Retrieves aJBIG2Pagespecified by the given page number.protected booleanprivate boolean(package private) booleanprivate voidThis method maps the stream and stores all segments.private voidThis method reads the stream and sets variables for information about organization type and length etc.private booleanreachedEndOfStream(long offset) This method checks, if the stream is at its end to avoidEOFExceptions and reads 32 bits.
-
Field Details
-
FILE_HEADER_ID
private int[] FILE_HEADER_IDID string in file header, see ISO/IEC 14492:2001, D.4.1 -
pages
-
fileHeaderLength
private short fileHeaderLengthThe length of the file header if exists -
organisationType
private short organisationTypeAccording to D.4.2 - File header bit 0This flag contains information about the file organization:
1for sequential0for random-access
RANDOMandSEQUENTIAL. -
RANDOM
public static final int RANDOM- See Also:
-
SEQUENTIAL
public static final int SEQUENTIAL- See Also:
-
amountOfPagesUnknown
private boolean amountOfPagesUnknownAccording to D.4.2 - Bit 1
trueif amount of pages is unknown, amount of pages field is not presentfalseif there is a field in the file header where the amount of pages can be read
-
amountOfPages
private int amountOfPagesAccording to D.4.3 - Number of pages field (4 bytes). Only present ifamountOfPagesUnknownisfalse. -
gbUseExtTemplate
private boolean gbUseExtTemplateDefines whether extended Template is used. -
subInputStream
This is the source data stream wrapped into aSubInputStream. -
globalSegments
Holds a load of segments, that aren't associated with a page.
-
-
Constructor Details
-
JBIG2Document
- Throws:
IOException
-
JBIG2Document
- Throws:
IOException
-
-
Method Details
-
getGlobalSegment
Retrieves the segment with the given segment number considering only segments that aren't associated with a page.- Parameters:
segmentNr- - The number of the wanted segment.- Returns:
- The requested
SegmentHeader.
-
getPage
-
getAmountOfPages
Retrieves the amount of pages in this JBIG2 document. If the pages are striped, the document will be completely parsed and the amount of pages will be gathered.- Returns:
- The amount of pages in this JBIG2 document.
- Throws:
IOException
-
mapStream
This method maps the stream and stores all segments.- Throws:
IOException
-
isFileHeaderPresent
- Throws:
IOException
-
determineRandomDataOffsets
Determines the start of the data parts and sets the offset.- Parameters:
segments-offset-
-
parseFileHeader
This method reads the stream and sets variables for information about organization type and length etc.- Throws:
IOException
-
reachedEndOfStream
This method checks, if the stream is at its end to avoidEOFExceptions and reads 32 bits.- Parameters:
offset-- Returns:
trueif end of stream reachedfalseif there are more bytes to read- Throws:
IOException
-
getGlobalSegments
-
isAmountOfPagesUnknown
protected boolean isAmountOfPagesUnknown() -
isGbUseExtTemplate
boolean isGbUseExtTemplate()
-