org.apache.pivot.serialization
Class ByteArraySerializer
java.lang.Object
org.apache.pivot.serialization.ByteArraySerializer
- All Implemented Interfaces:
- Serializer<byte[]>
public class ByteArraySerializer
- extends Object
- implements Serializer<byte[]>
Implementation of the Serializer
interface that reads and writes a
byte array.
- See Also:
Serializer
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MIME_TYPE
public static final String MIME_TYPE
- See Also:
- Constant Field Values
BUFFER_SIZE
public static final int BUFFER_SIZE
- See Also:
- Constant Field Values
ByteArraySerializer
public ByteArraySerializer()
readObject
public byte[] readObject(InputStream inputStream)
throws IOException,
SerializationException
- Reads a byte array from an input stream.
- Specified by:
readObject
in interface Serializer<byte[]>
- Parameters:
inputStream
- The data stream from which the object will be read.
- Returns:
- The deserialized object.
- Throws:
IOException
SerializationException
writeObject
public void writeObject(byte[] bytes,
OutputStream outputStream)
throws IOException,
SerializationException
- Writes a byte array to an output stream.
- Specified by:
writeObject
in interface Serializer<byte[]>
- Parameters:
bytes
- The object to serialize.outputStream
- The data stream to which the object will be written.
- Throws:
IOException
SerializationException
getMIMEType
public String getMIMEType(byte[] bytes)
- Description copied from interface:
Serializer
- Returns the MIME type of the data read and written by this serializer.
- Specified by:
getMIMEType
in interface Serializer<byte[]>
- Parameters:
bytes
- 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.