Package org.apache.pivot.wtk.media
Class BufferedImageSerializer
- java.lang.Object
- 
- org.apache.pivot.wtk.media.BufferedImageSerializer
 
- 
- All Implemented Interfaces:
- Serializer<java.awt.image.BufferedImage>
 
 public class BufferedImageSerializer extends java.lang.Object implements Serializer<java.awt.image.BufferedImage> Implementation of theSerializerinterface that reads and writes instances ofBufferedImage.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classBufferedImageSerializer.FormatSupported image formats.
 - 
Constructor SummaryConstructors Constructor Description BufferedImageSerializer()Construct an image serializer for the defaultPNGformat.BufferedImageSerializer(BufferedImageSerializer.Format outputFormat)Construct an image serializer for the given format.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetMIMEType(java.awt.image.BufferedImage bufferedImage)Returns the MIME type of the data read and written by this serializer.BufferedImageSerializer.FormatgetOutputFormat()java.awt.image.BufferedImagereadObject(java.io.InputStream inputStream)Reads a serialized image from an input stream.voidsetOutputFormat(BufferedImageSerializer.Format outputFormat)Sets the image format that this serializer should use for output.voidwriteObject(java.awt.image.BufferedImage bufferedImage, java.io.OutputStream outputStream)Writes a buffered image to an output stream.
 
- 
- 
- 
Constructor Detail- 
BufferedImageSerializerpublic BufferedImageSerializer() Construct an image serializer for the defaultPNGformat.
 - 
BufferedImageSerializerpublic BufferedImageSerializer(BufferedImageSerializer.Format outputFormat) Construct an image serializer for the given format.- Parameters:
- outputFormat- The output format for this serializer.
 
 
- 
 - 
Method Detail- 
getOutputFormatpublic BufferedImageSerializer.Format getOutputFormat() - Returns:
- The image format that this serializer is using for output.
 
 - 
setOutputFormatpublic void setOutputFormat(BufferedImageSerializer.Format outputFormat) Sets the image format that this serializer should use for output.- Parameters:
- outputFormat- The new format to use for output.
 
 - 
readObjectpublic java.awt.image.BufferedImage readObject(java.io.InputStream inputStream) throws java.io.IOException, SerializationExceptionReads a serialized image from an input stream.- Specified by:
- readObjectin interface- Serializer<java.awt.image.BufferedImage>
- Parameters:
- inputStream- The stream to read the image from.
- Returns:
- A BufferedImageobject
- Throws:
- java.io.IOException- for any errors accessing or reading the object.
- SerializationException- for any formatting errors encountered while deserializing the object.
 
 - 
writeObjectpublic void writeObject(java.awt.image.BufferedImage bufferedImage, java.io.OutputStream outputStream) throws java.io.IOException, SerializationExceptionWrites a buffered image to an output stream.- Specified by:
- writeObjectin interface- Serializer<java.awt.image.BufferedImage>
- Parameters:
- bufferedImage- The image to write out to the stream.
- outputStream- The stream to write the image out to.
- Throws:
- java.io.IOException- for any errors accessing or reading the object.
- SerializationException- for any formatting errors encountered while deserializing the object.
 
 - 
getMIMETypepublic final java.lang.String getMIMEType(java.awt.image.BufferedImage bufferedImage) Description copied from interface:SerializerReturns the MIME type of the data read and written by this serializer.- Specified by:
- getMIMETypein interface- Serializer<java.awt.image.BufferedImage>
- Parameters:
- bufferedImage- If provided, allows the serializer to attach parameters to the returned MIME type containing more detailed information about the data. If- null, the base MIME type is returned.
- Returns:
- The MIME type of the current data.
 
 
- 
 
-