public final class ImageIO
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
IMAGE_MAGIC_NUMBER_LEN |
| Modifier and Type | Method and Description |
|---|---|
static ImageReader |
getReader(ImageType imgType)
ImageReader factory
|
static ImageReader |
getReader(PeekHeadInputStream peekHeadInputStream)
Creates an ImageReader for the image specified by the PeekHeadInputStream.
|
static ImageWriter |
getWriter(ImageType imgType)
ImageWriter factory
|
static java.awt.image.BufferedImage |
read(java.io.File file) |
static java.awt.image.BufferedImage |
read(java.io.InputStream is)
Read the image or the first frame of the image as a BufferedImage
from the InputStream for the image.
|
static java.awt.image.BufferedImage |
read(java.lang.String path) |
static void |
write(java.awt.image.BufferedImage img,
java.io.OutputStream os,
ImageType imageType) |
static void |
write(java.awt.image.BufferedImage img,
java.io.OutputStream os,
ImageType imageType,
ImageParam imageParam) |
public static final int IMAGE_MAGIC_NUMBER_LEN
public static ImageReader getReader(ImageType imgType)
imgType - image type enum defined by ImageTypepublic static ImageReader getReader(PeekHeadInputStream peekHeadInputStream)
Note: The reason we are using a PeekHeadInputStream is that image type probing will eat some bytes of the input stream. After the image type probing, we will have to be able to access the bytes previous read. We could have used a RandomAccessInputStream interface, but not all image types require random access while reading. In those cases, using a RandomAccessInputStream will degrade performance as well as require more memory. This is especially true when file cache based RandomAccessInputStream implementation is used.
peekHeadInputStream - A PeekHeadInputStream wrapper for the image input streampublic static ImageWriter getWriter(ImageType imgType)
imgType - image type enum defined by ImageTypepublic static java.awt.image.BufferedImage read(java.io.File file)
throws java.lang.Exception
file - input image Filejava.lang.Exceptionpublic static java.awt.image.BufferedImage read(java.io.InputStream is)
throws java.lang.Exception
is - InputStream for the imagejava.lang.Exceptionpublic static java.awt.image.BufferedImage read(java.lang.String path)
throws java.lang.Exception
path - input image pathjava.lang.Exceptionpublic static void write(java.awt.image.BufferedImage img,
java.io.OutputStream os,
ImageType imageType)
throws java.lang.Exception
java.lang.Exceptionpublic static void write(java.awt.image.BufferedImage img,
java.io.OutputStream os,
ImageType imageType,
ImageParam imageParam)
throws java.lang.Exception
java.lang.Exception