org.apache.pivot.wtk.media
Class BufferedImageSerializer

java.lang.Object
  extended by org.apache.pivot.wtk.media.BufferedImageSerializer
All Implemented Interfaces:
Serializer<BufferedImage>

public class BufferedImageSerializer
extends Object
implements Serializer<BufferedImage>

Implementation of the Serializer interface that reads and writes instances of BufferedImage.


Nested Class Summary
static class BufferedImageSerializer.Format
          Supported image formats.
 
Constructor Summary
BufferedImageSerializer()
           
BufferedImageSerializer(BufferedImageSerializer.Format outputFormat)
           
 
Method Summary
 String getMIMEType(BufferedImage bufferedImage)
          Returns the MIME type of the data read and written by this serializer.
 BufferedImageSerializer.Format getOutputFormat()
          Gets the image format that this serializer is using for output.
 BufferedImage readObject(InputStream inputStream)
          Reads a serialized image from an input stream.
 void setOutputFormat(BufferedImageSerializer.Format outputFormat)
          Sets the image format that this serializer should use for output.
 void writeObject(BufferedImage bufferedImage, OutputStream outputStream)
          Writes a buffered image to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedImageSerializer

public BufferedImageSerializer()

BufferedImageSerializer

public BufferedImageSerializer(BufferedImageSerializer.Format outputFormat)
Method Detail

getOutputFormat

public BufferedImageSerializer.Format getOutputFormat()
Gets the image format that this serializer is using for output.


setOutputFormat

public void setOutputFormat(BufferedImageSerializer.Format outputFormat)
Sets the image format that this serializer should use for output.


readObject

public BufferedImage readObject(InputStream inputStream)
                         throws IOException,
                                SerializationException
Reads a serialized image from an input stream.

Specified by:
readObject in interface Serializer<BufferedImage>
Parameters:
inputStream - The data stream from which the object will be read.
Returns:
A BufferedImage object
Throws:
IOException
SerializationException

writeObject

public void writeObject(BufferedImage bufferedImage,
                        OutputStream outputStream)
                 throws IOException,
                        SerializationException
Writes a buffered image to an output stream.

Specified by:
writeObject in interface Serializer<BufferedImage>
Parameters:
bufferedImage - The object to serialize.
outputStream - The data stream to which the object will be written.
Throws:
IOException
SerializationException

getMIMEType

public String getMIMEType(BufferedImage bufferedImage)
Description copied from interface: Serializer
Returns the MIME type of the data read and written by this serializer.

Specified by:
getMIMEType in interface Serializer<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.