Class J2KImageReader
- java.lang.Object
-
- javax.imageio.ImageReader
-
- com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReader
-
- All Implemented Interfaces:
MsgLogger
public class J2KImageReader extends ImageReader implements MsgLogger
This class is the Java Image IO plugin reader for JPEG 2000 JP2 image file format. It has the capability to load the compressed bilevel images, color-indexed byte images, or multi-band images in byte/ushort/short/int data type. It may subsample the image, select bands, clip the image, and shift the decoded image origin if the proper decoding parameter are set in the providedJ2KImageReadParam
.
-
-
Field Summary
-
Fields inherited from class javax.imageio.ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
-
-
Constructor Summary
Constructors Constructor Description J2KImageReader(ImageReaderSpi originator)
ConstructsJ2KImageReader
from the providedImageReaderSpi
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canReadRaster()
static void
checkReadParamBandSettingsWrapper(ImageReadParam param, int numSrcBands, int numDstBands)
Wrapper for the protected methodcheckReadParamBandSettings
.static void
computeRegionsWrapper(ImageReadParam param, boolean allowZeroDestOffset, int srcWidth, int srcHeight, BufferedImage image, Rectangle srcRegion, Rectangle destRegion)
Wrapper for the protected methodcomputeRegions
.void
dispose()
void
flush()
Writes any buffered data from the println() method to the device.boolean
getAbortRequest()
This method wraps the protected methodabortRequested
to allow the abortions be monitored byJ2KReadState
.ImageReadParam
getDefaultReadParam()
int
getHeight(int imageIndex)
IIOMetadata
getImageMetadata(int imageIndex)
Iterator
getImageTypes(int imageIndex)
int
getNumImages(boolean allowSearch)
Overrides the method defined in the superclass.IIOMetadata
getStreamMetadata()
int
getTileGridXOffset(int imageIndex)
int
getTileGridYOffset(int imageIndex)
int
getTileHeight(int imageIndex)
int
getTileWidth(int imageIndex)
int
getWidth(int imageIndex)
boolean
isImageTiled(int imageIndex)
boolean
isRandomAccessEasy(int imageIndex)
void
println(String str, int flind, int ind)
Prints the string 'str' to the output device, appending a line return.void
printmsg(int sev, String msg)
Prints the message 'msg' to the output device, appending a newline, with severity 'sev'.void
processImageProgressWrapper(float percentageDone)
Wrapper for the protected methodprocessImageProgress
So it can be access from the classes which are not inImageReader
hierarchy.void
processImageUpdateWrapper(BufferedImage theImage, int minX, int minY, int width, int height, int periodX, int periodY, int[] bands)
Wrapper for the protected methodprocessImageUpdate
So it can be access from the classes which are not inImageReader
hierarchy.BufferedImage
read(int imageIndex, ImageReadParam param)
RenderedImage
readAsRenderedImage(int imageIndex, ImageReadParam param)
void
readHeader()
Raster
readRaster(int imageIndex, ImageReadParam param)
void
reset()
void
setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata)
Overrides the method defined in the superclass.-
Methods inherited from class javax.imageio.ImageReader
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDestination, getFormatName, getImageMetadata, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, hasThumbnails, isIgnoringMetadata, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, read, readAll, readAll, readerSupportsThumbnails, readThumbnail, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setInput, setInput, setLocale
-
-
-
-
Constructor Detail
-
J2KImageReader
public J2KImageReader(ImageReaderSpi originator)
ConstructsJ2KImageReader
from the providedImageReaderSpi
.
-
-
Method Detail
-
computeRegionsWrapper
public static void computeRegionsWrapper(ImageReadParam param, boolean allowZeroDestOffset, int srcWidth, int srcHeight, BufferedImage image, Rectangle srcRegion, Rectangle destRegion)
Wrapper for the protected methodcomputeRegions
. So it can be access from the classes which are not inImageReader
hierarchy.
-
checkReadParamBandSettingsWrapper
public static void checkReadParamBandSettingsWrapper(ImageReadParam param, int numSrcBands, int numDstBands)
Wrapper for the protected methodcheckReadParamBandSettings
. So it can be access from the classes which are not inImageReader
hierarchy.
-
processImageUpdateWrapper
public void processImageUpdateWrapper(BufferedImage theImage, int minX, int minY, int width, int height, int periodX, int periodY, int[] bands)
Wrapper for the protected methodprocessImageUpdate
So it can be access from the classes which are not inImageReader
hierarchy.
-
processImageProgressWrapper
public void processImageProgressWrapper(float percentageDone)
Wrapper for the protected methodprocessImageProgress
So it can be access from the classes which are not inImageReader
hierarchy.
-
setInput
public void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata)
Overrides the method defined in the superclass.- Overrides:
setInput
in classImageReader
-
getNumImages
public int getNumImages(boolean allowSearch) throws IOException
Overrides the method defined in the superclass.- Specified by:
getNumImages
in classImageReader
- Throws:
IOException
-
getWidth
public int getWidth(int imageIndex) throws IOException
- Specified by:
getWidth
in classImageReader
- Throws:
IOException
-
getHeight
public int getHeight(int imageIndex) throws IOException
- Specified by:
getHeight
in classImageReader
- Throws:
IOException
-
getTileGridXOffset
public int getTileGridXOffset(int imageIndex) throws IOException
- Overrides:
getTileGridXOffset
in classImageReader
- Throws:
IOException
-
getTileGridYOffset
public int getTileGridYOffset(int imageIndex) throws IOException
- Overrides:
getTileGridYOffset
in classImageReader
- Throws:
IOException
-
getTileWidth
public int getTileWidth(int imageIndex) throws IOException
- Overrides:
getTileWidth
in classImageReader
- Throws:
IOException
-
getTileHeight
public int getTileHeight(int imageIndex) throws IOException
- Overrides:
getTileHeight
in classImageReader
- Throws:
IOException
-
readHeader
public void readHeader()
-
getImageTypes
public Iterator getImageTypes(int imageIndex) throws IOException
- Specified by:
getImageTypes
in classImageReader
- Throws:
IOException
-
getDefaultReadParam
public ImageReadParam getDefaultReadParam()
- Overrides:
getDefaultReadParam
in classImageReader
-
getImageMetadata
public IIOMetadata getImageMetadata(int imageIndex) throws IOException
- Specified by:
getImageMetadata
in classImageReader
- Throws:
IOException
-
getStreamMetadata
public IIOMetadata getStreamMetadata() throws IOException
- Specified by:
getStreamMetadata
in classImageReader
- Throws:
IOException
-
read
public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException
- Specified by:
read
in classImageReader
- Throws:
IOException
-
readAsRenderedImage
public RenderedImage readAsRenderedImage(int imageIndex, ImageReadParam param) throws IOException
- Overrides:
readAsRenderedImage
in classImageReader
- Throws:
IOException
-
canReadRaster
public boolean canReadRaster()
- Overrides:
canReadRaster
in classImageReader
-
isRandomAccessEasy
public boolean isRandomAccessEasy(int imageIndex) throws IOException
- Overrides:
isRandomAccessEasy
in classImageReader
- Throws:
IOException
-
readRaster
public Raster readRaster(int imageIndex, ImageReadParam param) throws IOException
- Overrides:
readRaster
in classImageReader
- Throws:
IOException
-
isImageTiled
public boolean isImageTiled(int imageIndex)
- Overrides:
isImageTiled
in classImageReader
-
reset
public void reset()
- Overrides:
reset
in classImageReader
-
getAbortRequest
public boolean getAbortRequest()
This method wraps the protected methodabortRequested
to allow the abortions be monitored byJ2KReadState
.
-
dispose
public void dispose()
- Overrides:
dispose
in classImageReader
-
flush
public void flush()
Description copied from interface:MsgLogger
Writes any buffered data from the println() method to the device.
-
println
public void println(String str, int flind, int ind)
Description copied from interface:MsgLogger
Prints the string 'str' to the output device, appending a line return. The message is reformatted as appropriate to the particular diplaying device, where 'flind' and 'ind' are used as hints for performing that operation. However, any newlines appearing in 'str' are respected. The output device may not display the string until flush() is called. Some implementations may automatically flush when this method is called. This method just prints the string, the string does not make part of a "message" in the sense that no severity is associated to it.
-
printmsg
public void printmsg(int sev, String msg)
Description copied from interface:MsgLogger
Prints the message 'msg' to the output device, appending a newline, with severity 'sev'. Some implementations where the appended newline is irrelevant may not append the newline. Depending on the implementation the severity of the message may be added to it. The message is reformatted as appropriate for the output devic, but any newline characters are respected.
-
-