T - The class to serialize, see Serializablepublic class ObjectRepresentation<T extends java.io.Serializable> extends OutputRepresentation
UNKNOWN_SIZE| Constructor and Description |
|---|
ObjectRepresentation(Representation serializedRepresentation)
Constructor reading the object from a serialized representation.
|
ObjectRepresentation(T object)
Constructor for the
MediaType.APPLICATION_JAVA_OBJECT type. |
ObjectRepresentation(T object,
MediaType mediaType)
Constructor for either the
MediaType.APPLICATION_JAVA_OBJECT type
or the MediaType.APPLICATION_XML type. |
| Modifier and Type | Method and Description |
|---|---|
T |
getObject()
Returns the represented object.
|
void |
release()
Releases the represented object.
|
void |
setObject(T object)
Sets the represented object.
|
void |
write(java.io.OutputStream outputStream)
Writes the representation to a byte stream.
|
getStreamgetChannel, getReader, write, writecheckDigest, checkDigest, computeDigest, createEmpty, exhaust, getAvailableSize, getDigest, getDisposition, getDownloadName, getExpirationDate, getRange, getSize, getText, isAvailable, isDownloadable, isTransient, setAvailable, setDigest, setDisposition, setDownloadable, setDownloadName, setExpirationDate, setRange, setSize, setTransientgetModificationDate, getTag, setModificationDate, setTagcreateClientInfo, equals, getCharacterSet, getEncodings, getIdentifier, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setIdentifier, setIdentifier, setLanguages, setLocationRef, setLocationRef, setMediaType, toStringpublic ObjectRepresentation(Representation serializedRepresentation) throws java.io.IOException, java.lang.ClassNotFoundException, java.lang.IllegalArgumentException
serializedRepresentation - The serialized representation.java.io.IOExceptionjava.lang.ClassNotFoundExceptionjava.lang.IllegalArgumentExceptionpublic ObjectRepresentation(T object)
MediaType.APPLICATION_JAVA_OBJECT type.object - The serializable object.public ObjectRepresentation(T object, MediaType mediaType)
MediaType.APPLICATION_JAVA_OBJECT type
or the MediaType.APPLICATION_XML type. In the first case, the
Java Object Serialization mechanism is used, based on
ObjectOutputStream. In the latter case, the JavaBeans XML
serialization is used, based on java.beans.XMLEncoder.object - The serializable object.mediaType - The media type.public T getObject() throws java.io.IOException
java.io.IOExceptionpublic void release()
release in class Representationpublic void setObject(T object)
object - The represented object.public void write(java.io.OutputStream outputStream)
throws java.io.IOException
RepresentationOutputStream after writing to it as this will be handled by
the Restlet connectors automatically.write in class RepresentationoutputStream - The output stream.java.io.IOExceptionCopyright © 2005-2012. All Rights Reserved.