Package org.apache.pdfbox.jbig2
Class JBIG2ImageReader
java.lang.Object
javax.imageio.ImageReader
org.apache.pdfbox.jbig2.JBIG2ImageReader
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate JBIG2Document
JBIG2 document to which we delegate current work.private JBIG2Globals
Globals are JBIG2 segments for PDF wide use.Fields inherited from class javax.imageio.ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
private JBIG2ReadParam
getDefaultReadParam
(int imageIndex) Returns a default ImageReadParam object for a specific page.private JBIG2Document
Returns decoded segments that has been set as globals.int
getHeight
(int imageIndex) Calculates the height of the specified page.getImageMetadata
(int imageIndex) Simply returns theJBIG2ImageMetadata
.getImageTypes
(int imageIndex) Returns the iterator for available image types.int
getNumImages
(boolean allowSearch) private JBIG2Page
getPage
(int imageIndex) This ImageIO plugin doesn't recordIIOMetadata
.int
getWidth
(int imageIndex) Calculates the width of the specified page.processGlobals
(ImageInputStream globalsInputStream) Decodes and returns the global segments.read
(int imageIndex, ImageReadParam param) Returns the decoded image of specified page considering the givenJBIG2ReadParam
s.readRaster
(int imageIndex, ImageReadParam param) void
setGlobals
(JBIG2Globals globals) Simply sets the globals.void
Methods inherited from class javax.imageio.ImageReader
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, checkReadParamBandSettings, clearAbortRequest, computeRegions, dispose, getAspectRatio, getAvailableLocales, getDestination, getFormatName, getImageMetadata, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, hasThumbnails, isIgnoringMetadata, isImageTiled, isRandomAccessEasy, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, read, readAll, readAll, readAsRenderedImage, readerSupportsThumbnails, readThumbnail, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, reset, setInput, setInput, setLocale
-
Field Details
-
document
JBIG2 document to which we delegate current work. -
globals
Globals are JBIG2 segments for PDF wide use.
-
-
Constructor Details
-
JBIG2ImageReader
- Parameters:
originatingProvider
- - TheImageReaderSpi
that is invoking this constructor, ornull
.- Throws:
IOException
- if something went wrong while reading the provided stream.- See Also:
-
-
Method Details
-
getDefaultReadParam
- Overrides:
getDefaultReadParam
in classImageReader
- See Also:
-
getDefaultReadParam
Returns a default ImageReadParam object for a specific page.- Parameters:
imageIndex
- - The page number.- Returns:
-
getWidth
Calculates the width of the specified page.- Specified by:
getWidth
in classImageReader
- Parameters:
imageIndex
- - The image index. In this case it is the page number.- Returns:
- The width of the specified page.
- Throws:
IOException
- if an error occurs reading the width information from the input source.
-
getHeight
Calculates the height of the specified page.- Specified by:
getHeight
in classImageReader
- Parameters:
imageIndex
- - The image index. In this case it is the page number.- Returns:
- The height of the specified page or
0
if an error occurred. - Throws:
IOException
- if an error occurs reading the height information from the input source.
-
getImageMetadata
Simply returns theJBIG2ImageMetadata
.- Specified by:
getImageMetadata
in classImageReader
- Returns:
- The associated
JBIG2ImageMetadata
. - Throws:
IOException
- if an error occurs reading the height information from the input source.
-
getImageTypes
Returns the iterator for available image types.- Specified by:
getImageTypes
in classImageReader
- Parameters:
imageIndex
- - The page number.- Returns:
- An
Iterator
for available image types. - Throws:
IOException
- if an error occurs reading the height information from the input source.
-
getNumImages
- Specified by:
getNumImages
in classImageReader
- Throws:
IOException
- See Also:
-
getStreamMetadata
This ImageIO plugin doesn't recordIIOMetadata
.- Specified by:
getStreamMetadata
in classImageReader
- Returns:
null
at every call.
-
getGlobals
Returns decoded segments that has been set as globals. Globals are jbig2 segments that are used in embedded case for file wide access. They are not assigned to a specific page.- Returns:
- Decoded global segments.
- Throws:
IOException
- if an error occurs reading the height information from the input source.
-
read
Returns the decoded image of specified page considering the givenJBIG2ReadParam
s.- Specified by:
read
in classImageReader
- Throws:
IOException
- See Also:
-
canReadRaster
public boolean canReadRaster()- Overrides:
canReadRaster
in classImageReader
-
readRaster
- Overrides:
readRaster
in classImageReader
- Throws:
IOException
-
processGlobals
Decodes and returns the global segments.- Parameters:
globalsInputStream
- - The input stream of globals data.- Returns:
- The decoded
JBIG2Globals
. - Throws:
IOException
- if an error occurs reading the height information from the input source.
-
setGlobals
Simply sets the globals.- Parameters:
globals
- - The globals to set.- Throws:
IOException
- if an error occurs
-
setInput
- Overrides:
setInput
in classImageReader
- See Also:
-
getDocument
- Throws:
IOException
-
getPage
- Throws:
IOException
-