Package org.apache.pdfbox.jbig2
Class JBIG2ImageReader
- java.lang.Object
-
- javax.imageio.ImageReader
-
- org.apache.pdfbox.jbig2.JBIG2ImageReader
-
public class JBIG2ImageReader extends javax.imageio.ImageReader
-
-
Field Summary
Fields Modifier and Type Field Description private JBIG2DocumentdocumentJBIG2 document to which we delegate current work.private JBIG2GlobalsglobalsGlobals are JBIG2 segments for PDF wide use.
-
Constructor Summary
Constructors Constructor Description JBIG2ImageReader(javax.imageio.spi.ImageReaderSpi originatingProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanReadRaster()JBIG2ReadParamgetDefaultReadParam()private JBIG2ReadParamgetDefaultReadParam(int imageIndex)Returns a default ImageReadParam object for a specific page.private JBIG2DocumentgetDocument()JBIG2GlobalsgetGlobals()Returns decoded segments that has been set as globals.intgetHeight(int imageIndex)javax.imageio.metadata.IIOMetadatagetImageMetadata(int imageIndex)java.util.Iterator<javax.imageio.ImageTypeSpecifier>getImageTypes(int imageIndex)intgetNumImages(boolean allowSearch)private JBIG2PagegetPage(int imageIndex)Return the page.javax.imageio.metadata.IIOMetadatagetStreamMetadata()This ImageIO plugin doesn't recordIIOMetadata.intgetWidth(int imageIndex)JBIG2GlobalsprocessGlobals(javax.imageio.stream.ImageInputStream globalsInputStream)Decodes and returns the global segments.java.awt.image.BufferedImageread(int imageIndex, javax.imageio.ImageReadParam param)java.awt.image.RasterreadRaster(int imageIndex, javax.imageio.ImageReadParam param)voidsetGlobals(JBIG2Globals globals)Simply sets the globals.voidsetInput(java.lang.Object input, boolean seekForwardOnly, boolean ignoreMetadata)-
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 Detail
-
document
private JBIG2Document document
JBIG2 document to which we delegate current work.
-
globals
private JBIG2Globals globals
Globals are JBIG2 segments for PDF wide use.
-
-
Method Detail
-
getDefaultReadParam
public JBIG2ReadParam getDefaultReadParam()
- Overrides:
getDefaultReadParamin classjavax.imageio.ImageReader
-
getDefaultReadParam
private JBIG2ReadParam getDefaultReadParam(int imageIndex)
Returns a default ImageReadParam object for a specific page.- Parameters:
imageIndex- - The page number.- Returns:
-
getWidth
public int getWidth(int imageIndex) throws java.io.IOException- Specified by:
getWidthin classjavax.imageio.ImageReader- Throws:
java.io.IOException
-
getHeight
public int getHeight(int imageIndex) throws java.io.IOException- Specified by:
getHeightin classjavax.imageio.ImageReader- Throws:
java.io.IOException
-
getImageMetadata
public javax.imageio.metadata.IIOMetadata getImageMetadata(int imageIndex) throws java.io.IOException- Specified by:
getImageMetadatain classjavax.imageio.ImageReader- Throws:
java.io.IOException
-
getImageTypes
public java.util.Iterator<javax.imageio.ImageTypeSpecifier> getImageTypes(int imageIndex) throws java.io.IOException- Specified by:
getImageTypesin classjavax.imageio.ImageReader- Throws:
java.io.IOException
-
getNumImages
public int getNumImages(boolean allowSearch) throws java.io.IOException- Specified by:
getNumImagesin classjavax.imageio.ImageReader- Throws:
java.io.IOException
-
getStreamMetadata
public javax.imageio.metadata.IIOMetadata getStreamMetadata()
This ImageIO plugin doesn't recordIIOMetadata.- Specified by:
getStreamMetadatain classjavax.imageio.ImageReader- Returns:
nullat every call.
-
getGlobals
public JBIG2Globals getGlobals() throws java.io.IOException
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:
java.io.IOException- if an error occurs reading the height information from the input source.
-
read
public java.awt.image.BufferedImage read(int imageIndex, javax.imageio.ImageReadParam param) throws java.io.IOException- Specified by:
readin classjavax.imageio.ImageReader- Throws:
java.io.IOException
-
canReadRaster
public boolean canReadRaster()
- Overrides:
canReadRasterin classjavax.imageio.ImageReader
-
readRaster
public java.awt.image.Raster readRaster(int imageIndex, javax.imageio.ImageReadParam param) throws java.io.IOException- Overrides:
readRasterin classjavax.imageio.ImageReader- Throws:
java.io.IOException
-
processGlobals
public JBIG2Globals processGlobals(javax.imageio.stream.ImageInputStream globalsInputStream) throws java.io.IOException
Decodes and returns the global segments.- Parameters:
globalsInputStream- - The input stream of globals data.- Returns:
- The decoded
JBIG2Globals. - Throws:
java.io.IOException- if an error occurs reading the height information from the input source.
-
setGlobals
public void setGlobals(JBIG2Globals globals) throws java.io.IOException
Simply sets the globals.- Parameters:
globals- - The globals to set.- Throws:
java.io.IOException- if an error occurs
-
setInput
public void setInput(java.lang.Object input, boolean seekForwardOnly, boolean ignoreMetadata)- Overrides:
setInputin classjavax.imageio.ImageReader
-
getDocument
private JBIG2Document getDocument() throws java.io.IOException
- Throws:
java.io.IOException
-
getPage
private JBIG2Page getPage(int imageIndex) throws java.io.IOException
Return the page.- Parameters:
imageIndex- 0 based page index.- Returns:
- The page.
- Throws:
java.io.IOException- if the input wasn't set.java.lang.IndexOutOfBoundsException- if the page doesn't exist at that index.
-
-