|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.representation.Variant
org.restlet.representation.RepresentationInfo
org.restlet.representation.Representation
org.restlet.util.WrapperRepresentation
public class WrapperRepresentation
Representation wrapper. Useful for application developer who need to enrich the representation with application related properties and behavior.
| Field Summary |
|---|
| Fields inherited from class org.restlet.representation.Representation |
|---|
UNKNOWN_SIZE |
| Constructor Summary | |
|---|---|
WrapperRepresentation(Representation wrappedRepresentation)
Constructor. |
|
| Method Summary | |
|---|---|
long |
exhaust()
Exhaust the content of the representation by reading it and silently discarding anything read. |
long |
getAvailableSize()
Returns the size effectively available. |
ReadableByteChannel |
getChannel()
Returns a channel with the representation's content. If it is supported by a file, a read-only instance of FileChannel is returned. This method is ensured to return a fresh channel for each invocation unless it is a transient representation, in which case null is returned. |
CharacterSet |
getCharacterSet()
Returns the character set or null if not applicable. |
Digest |
getDigest()
Returns the representation digest if any. Note that when used with HTTP connectors, this property maps to the "Content-MD5" header. |
Disposition |
getDisposition()
Returns the disposition characteristics of the representation. |
List<Encoding> |
getEncodings()
Returns the modifiable list of encodings applied to the entity-body. |
Date |
getExpirationDate()
Returns the future date when this representation expire. |
List<Language> |
getLanguages()
Returns the modifiable list of languages. |
Reference |
getLocationRef()
Returns an optional location reference. |
MediaType |
getMediaType()
Returns the media type. Note that when used with HTTP connectors, this property maps to the "Content-Type" header. |
Date |
getModificationDate()
Returns the last date when this representation was modified. |
Range |
getRange()
Returns the range where in the full content the partial content available should be applied. Note that when used with HTTP connectors, this property maps to the "Content-Range" header. |
Reader |
getReader()
Returns a characters reader with the representation's content. |
SelectionRegistration |
getRegistration()
Returns the NIO registration of the related channel with its selector. |
long |
getSize()
Returns the total size in bytes if known, UNKNOWN_SIZE (-1) otherwise. |
InputStream |
getStream()
Returns a stream with the representation's content. |
Tag |
getTag()
Returns the tag. Note that when used with HTTP connectors, this property maps to the "ETag" header. |
String |
getText()
Converts the representation to a string value. |
Representation |
getWrappedRepresentation()
Returns the wrapped representation. |
boolean |
isAvailable()
Indicates if some fresh content is potentially available, without having to actually call one of the content manipulation method like getStream() that would actually consume it. |
boolean |
isSelectable()
Indicates if the representation content supports NIO selection. |
boolean |
isTransient()
Indicates if the representation's content is transient, which means that it can be obtained only once. |
void |
release()
Releases the representation and all associated objects like streams, channels or files which are used to produce its content, transient or not. |
void |
setAvailable(boolean isAvailable)
Indicates if some fresh content is available. |
void |
setCharacterSet(CharacterSet characterSet)
Sets the character set or null if not applicable. Note that when used with HTTP connectors, this property maps to the "Content-Type" header. |
void |
setDigest(Digest digest)
Sets the representation digest. Note that when used with HTTP connectors, this property maps to the "Content-MD5" header. |
void |
setDisposition(Disposition disposition)
Sets the disposition characteristics of the representation. |
void |
setEncodings(List<Encoding> encodings)
Sets the list of encodings applied to the entity-body. Note that when used with HTTP connectors, this property maps to the "Content-Encoding" header. |
void |
setExpirationDate(Date expirationDate)
Sets the future date when this representation expire. |
void |
setLanguages(List<Language> languages)
Sets the list of languages. Note that when used with HTTP connectors, this property maps to the "Content-Language" header. |
void |
setLocationRef(Reference location)
Sets the optional identifier. |
void |
setLocationRef(String locationUri)
Sets the identifier from a URI string. Note that when used with HTTP connectors, this property maps to the "Content-Location" header. |
void |
setMediaType(MediaType mediaType)
Sets the media type. Note that when used with HTTP connectors, this property maps to the "Content-Type" header. |
void |
setModificationDate(Date modificationDate)
Sets the last date when this representation was modified. |
void |
setRange(Range range)
Sets the range where in the full content the partial content available should be applied. Note that when used with HTTP connectors, this property maps to the "Content-Range" header. |
void |
setSize(long expectedSize)
Sets the expected size in bytes if known, -1 otherwise. |
void |
setTag(Tag tag)
Sets the tag. Note that when used with HTTP connectors, this property maps to the "ETag" header. |
void |
setTransient(boolean isTransient)
Indicates if the representation's content is transient. |
void |
write(OutputStream outputStream)
Writes the representation to a byte stream. |
void |
write(WritableByteChannel writableChannel)
Writes the representation to a byte channel. |
void |
write(Writer writer)
Writes the representation to a characters writer. |
| Methods inherited from class org.restlet.representation.Representation |
|---|
append, hasKnownSize, isEmpty, setListener |
| Methods inherited from class org.restlet.representation.Variant |
|---|
createClientInfo, equals, includes, isCompatible, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public WrapperRepresentation(Representation wrappedRepresentation)
wrappedRepresentation - The wrapped representation.| Method Detail |
|---|
public long exhaust()
throws IOException
RepresentationRepresentation.getStream()
and closes the retrieved stream in the end.
exhaust in class RepresentationIOExceptionpublic long getAvailableSize()
RepresentationRepresentation.getSize() if no range is defined, otherwise it returns the size
of the range using Range.getSize().
getAvailableSize in class Representation
public ReadableByteChannel getChannel()
throws IOException
Representation
getChannel in class RepresentationIOExceptionpublic CharacterSet getCharacterSet()
Variant
getCharacterSet in class Variantpublic Digest getDigest()
Representation
getDigest in class Representationpublic Disposition getDisposition()
Representation
getDisposition in class Representationpublic List<Encoding> getEncodings()
Variant
getEncodings in class Variantpublic Date getExpirationDate()
Representation
getExpirationDate in class Representationpublic List<Language> getLanguages()
Variant
getLanguages in class Variantpublic Reference getLocationRef()
Variant
getLocationRef in class Variantpublic MediaType getMediaType()
Variant
getMediaType in class Variantpublic Date getModificationDate()
RepresentationInfo
getModificationDate in class RepresentationInfopublic Range getRange()
Representation
getRange in class Representation
public Reader getReader()
throws IOException
Representation
getReader in class RepresentationIOExceptionpublic long getSize()
RepresentationRepresentation.getAvailableSize() method.
getSize in class RepresentationRepresentation.isEmpty()
public InputStream getStream()
throws IOException
Representation
getStream in class RepresentationIOExceptionpublic Tag getTag()
RepresentationInfo
getTag in class RepresentationInfo
public String getText()
throws IOException
Representation
getText in class RepresentationIOExceptionpublic Representation getWrappedRepresentation()
public boolean isAvailable()
Representation
isAvailable in class Representationpublic boolean isSelectable()
RepresentationConnectionController.register(java.nio.channels.SelectableChannel, int, org.restlet.util.SelectionListener)
method can be called to be notified when new content is ready for
reading.
isSelectable in class RepresentationConnectionControllerpublic boolean isTransient()
Representation
isTransient in class Representation
public SelectionRegistration getRegistration()
throws IOException
Representation
getRegistration in class RepresentationIOExceptionRepresentation.isSelectable()public void release()
RepresentationRepresentation.setAvailable(boolean) method
with "false" as a value.Representation.exhaust() method or if this
could be too costly, you should instead explicitly abort the parent
request and the underlying connections using the Request.abort()
method or a shortcut one like
ServerResource.abort() or
Response.abort().
release in class Representationpublic void setAvailable(boolean isAvailable)
Representation
setAvailable in class RepresentationisAvailable - True if some fresh content is available.public void setCharacterSet(CharacterSet characterSet)
Variant
setCharacterSet in class VariantcharacterSet - The character set or null if not applicable.public void setDigest(Digest digest)
Representation
setDigest in class Representationdigest - The representation digest.public void setDisposition(Disposition disposition)
Representation
setDisposition in class Representationdisposition - The disposition characteristics of the representation.public void setEncodings(List<Encoding> encodings)
Variant
setEncodings in class Variantencodings - The list of encodings applied to the entity-body.public void setExpirationDate(Date expirationDate)
Representation
setExpirationDate in class RepresentationexpirationDate - The expiration date.public void setLanguages(List<Language> languages)
Variant
setLanguages in class Variantlanguages - The list of languages.public void setLocationRef(Reference location)
Variant
setLocationRef in class Variantlocation - The location reference.public void setLocationRef(String locationUri)
Variant
setLocationRef in class VariantlocationUri - The location URI to parse.public void setMediaType(MediaType mediaType)
Variant
setMediaType in class VariantmediaType - The media type.public void setModificationDate(Date modificationDate)
RepresentationInfo
setModificationDate in class RepresentationInfomodificationDate - The modification date.public void setRange(Range range)
Representation
setRange in class Representationrange - The content range.public void setSize(long expectedSize)
RepresentationRepresentation.getAvailableSize() method.
setSize in class RepresentationexpectedSize - The expected size in bytes if known, -1 otherwise.public void setTag(Tag tag)
RepresentationInfo
setTag in class RepresentationInfotag - The tag.public void setTransient(boolean isTransient)
Representation
setTransient in class RepresentationisTransient - True if the representation's content is transient.
public void write(OutputStream outputStream)
throws IOException
RepresentationOutputStream after writing to it as this will be handled by
the Restlet connectors automatically.
write in class RepresentationoutputStream - The output stream.
IOException
public void write(Writer writer)
throws IOException
RepresentationWriter after writing to it as this will be handled
by the Restlet connectors automatically.
write in class Representationwriter - The characters writer.
IOException
public void write(WritableByteChannel writableChannel)
throws IOException
Representation
write in class RepresentationwritableChannel - A writable byte channel.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||