Class JBIG2ImageReader


  • public class JBIG2ImageReader
    extends javax.imageio.ImageReader
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private JBIG2Document document
      JBIG2 document to which we delegate current work.
      private JBIG2Globals globals
      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 
      Constructor Description
      JBIG2ImageReader​(javax.imageio.spi.ImageReaderSpi originatingProvider)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canReadRaster()  
      JBIG2ReadParam getDefaultReadParam()  
      private JBIG2ReadParam getDefaultReadParam​(int imageIndex)
      Returns a default ImageReadParam object for a specific page.
      private JBIG2Document getDocument()  
      JBIG2Globals getGlobals()
      Returns decoded segments that has been set as globals.
      int getHeight​(int imageIndex)  
      javax.imageio.metadata.IIOMetadata getImageMetadata​(int imageIndex)  
      java.util.Iterator<javax.imageio.ImageTypeSpecifier> getImageTypes​(int imageIndex)  
      int getNumImages​(boolean allowSearch)  
      private JBIG2Page getPage​(int imageIndex)
      Return the page.
      javax.imageio.metadata.IIOMetadata getStreamMetadata()
      This ImageIO plugin doesn't record IIOMetadata.
      int getWidth​(int imageIndex)  
      JBIG2Globals processGlobals​(javax.imageio.stream.ImageInputStream globalsInputStream)
      Decodes and returns the global segments.
      java.awt.image.BufferedImage read​(int imageIndex, javax.imageio.ImageReadParam param)  
      java.awt.image.Raster readRaster​(int imageIndex, javax.imageio.ImageReadParam param)  
      void setGlobals​(JBIG2Globals globals)
      Simply sets the globals.
      void setInput​(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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
    • Constructor Detail

      • JBIG2ImageReader

        public JBIG2ImageReader​(javax.imageio.spi.ImageReaderSpi originatingProvider)
                         throws java.io.IOException
        Throws:
        java.io.IOException - if something went wrong while reading the provided stream.
    • Method Detail

      • getDefaultReadParam

        public JBIG2ReadParam getDefaultReadParam()
        Overrides:
        getDefaultReadParam in class javax.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:
        getWidth in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getHeight

        public int getHeight​(int imageIndex)
                      throws java.io.IOException
        Specified by:
        getHeight in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getImageMetadata

        public javax.imageio.metadata.IIOMetadata getImageMetadata​(int imageIndex)
                                                            throws java.io.IOException
        Specified by:
        getImageMetadata in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getImageTypes

        public java.util.Iterator<javax.imageio.ImageTypeSpecifier> getImageTypes​(int imageIndex)
                                                                           throws java.io.IOException
        Specified by:
        getImageTypes in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getNumImages

        public int getNumImages​(boolean allowSearch)
                         throws java.io.IOException
        Specified by:
        getNumImages in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • getStreamMetadata

        public javax.imageio.metadata.IIOMetadata getStreamMetadata()
        This ImageIO plugin doesn't record IIOMetadata.
        Specified by:
        getStreamMetadata in class javax.imageio.ImageReader
        Returns:
        null at 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:
        read in class javax.imageio.ImageReader
        Throws:
        java.io.IOException
      • canReadRaster

        public boolean canReadRaster()
        Overrides:
        canReadRaster in class javax.imageio.ImageReader
      • readRaster

        public java.awt.image.Raster readRaster​(int imageIndex,
                                                javax.imageio.ImageReadParam param)
                                         throws java.io.IOException
        Overrides:
        readRaster in class javax.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:
        setInput in class javax.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.