public class ImageReaderWriterHelper extends Object
PictureFileData
to simplify
its processing.Constructor and Description |
---|
ImageReaderWriterHelper(PictureUploadPolicy uploadPolicy,
PictureFileData pictureFileData)
Standard constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Free all reserved resource by this helper.
|
IIOMetadata |
getImageMetadata(int imageIndex)
Load the metadata associated with one picture in the picture file.
|
int |
getNumImages(boolean allowSearch)
Call to imageReader.getNumImages(boolean).
|
String |
getTargetPictureFormat()
returns the target picture format (lowercase, may be the same as the file extension)
|
IIOImage |
readAll(int imageIndex)
Read an image, from the pictureFileData.
|
BufferedImage |
readImage(int imageIndex)
Read an image, from the pictureFileData.
|
void |
setOutput(File file)
Creates a FileImageOutputStream, and assign it as the output to the imageWriter.
|
void |
write(IIOImage iioImage)
Write a picture in the output picture file.
|
void |
writeInsert(int numIndex,
IIOImage iioImage,
ImageWriteParam iwp)
Write a picture in the output picture file.
|
public ImageReaderWriterHelper(PictureUploadPolicy uploadPolicy, PictureFileData pictureFileData)
uploadPolicy
- The current upload policy.pictureFileData
- The file data to be 'helped'.public String getTargetPictureFormat()
public void setOutput(File file) throws JUploadIOException
file
- The file where the output stream must write.JUploadIOException
- Any error...public void dispose() throws JUploadIOException
JUploadIOException
- Any IO Exceptionpublic int getNumImages(boolean allowSearch) throws JUploadIOException
allowSearch
- JUploadIOException
public BufferedImage readImage(int imageIndex) throws JUploadIOException, IndexOutOfBoundsException
imageIndex
- The index number of the picture, in the file. 0 for the first picture (only valid value for
picture containing one picture)JUploadIOException
IndexOutOfBoundsException
- Occurs when the imageIndex is wrong.public IIOImage readAll(int imageIndex) throws JUploadIOException, IndexOutOfBoundsException
imageIndex
- The index number of the picture, in the file. 0 for the first picture (only valid value for
picture containing one picture)JUploadIOException
IndexOutOfBoundsException
- Occurs when the imageIndex is wrong.public IIOMetadata getImageMetadata(int imageIndex) throws JUploadIOException
imageIndex
- JUploadIOException
- Any IOException is encapsulated in this exceptionpublic void writeInsert(int numIndex, IIOImage iioImage, ImageWriteParam iwp) throws JUploadIOException
numIndex
- The index of the image in the transformed picture file.iioImage
- The image to write.iwp
- The parameter to use to write this image.JUploadIOException
public void write(IIOImage iioImage) throws JUploadIOException
iioImage
- The image to write.JUploadIOException
Copyright © 2015. All rights reserved.