|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.resource.Variant
org.restlet.resource.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.resource.Variant |
|---|
UNKNOWN_SIZE |
| Constructor Summary | |
|---|---|
WrapperRepresentation(Representation wrappedRepresentation)
Constructor. |
|
| Method Summary | |
|---|---|
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. |
List<Encoding> |
getEncodings()
Returns the list of encodings. |
Date |
getExpirationDate()
Returns the future date when this representation expire. |
Reference |
getIdentifier()
Returns the official identifier. |
List<Language> |
getLanguages()
Returns the list of languages. |
MediaType |
getMediaType()
Returns the media type. |
Date |
getModificationDate()
Returns the last date when this representation was modified. |
long |
getSize()
Returns the size in bytes if known, UNKNOWN_SIZE (-1) otherwise. |
InputStream |
getStream()
Returns a stream with the representation's content. |
Tag |
getTag()
Returns the tag. |
String |
getText()
Converts the representation to a string value. |
Representation |
getWrappedRepresentation()
Returns the wrapped representation. |
boolean |
isAvailable()
Indicates if some fresh content is available, without having to actually call one of the content manipulation method like getStream() that would actually consume it. |
boolean |
isTransient()
Indicates if the representation's content is transient, which means that it can be obtained only once. |
void |
setAvailable(boolean isAvailable)
Indicates if some fresh content is available. |
void |
setCharacterSet(CharacterSet characterSet)
Sets the character set or null if not applicable. |
void |
setExpirationDate(Date expirationDate)
Sets the future date when this representation expire. |
void |
setIdentifier(Reference identifier)
Sets the official identifier. |
void |
setIdentifier(String identifierUri)
Sets the official identifier from a URI string. |
void |
setMediaType(MediaType mediaType)
Sets the media type. |
void |
setModificationDate(Date modificationDate)
Sets the last date when this representation was modified. |
void |
setSize(long expectedSize)
Sets the expected size in bytes if known, -1 otherwise. |
void |
setTag(Tag tag)
Sets the tag. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WrapperRepresentation(Representation wrappedRepresentation)
wrappedRepresentation - The wrapped representation.| Method Detail |
|---|
public ReadableByteChannel getChannel()
throws IOException
getChannel in class RepresentationIOExceptionpublic CharacterSet getCharacterSet()
getCharacterSet in class Variantpublic List<Encoding> getEncodings()
getEncodings in class Variantpublic Date getExpirationDate()
getExpirationDate in class Variantpublic Reference getIdentifier()
getIdentifier in class Variantpublic List<Language> getLanguages()
getLanguages in class Variantpublic MediaType getMediaType()
getMediaType in class Variantpublic Date getModificationDate()
getModificationDate in class Variantpublic long getSize()
getSize in class Variant
public InputStream getStream()
throws IOException
getStream in class RepresentationIOExceptionpublic Tag getTag()
getTag in class Variant
public String getText()
throws IOException
getText in class RepresentationIOExceptionpublic Representation getWrappedRepresentation()
public boolean isAvailable()
isAvailable in class Representationpublic boolean isTransient()
isTransient in class Representationpublic void setAvailable(boolean isAvailable)
setAvailable in class RepresentationisAvailable - True if some fresh content is available.public void setCharacterSet(CharacterSet characterSet)
setCharacterSet in class VariantcharacterSet - The character set or null if not applicable.public void setExpirationDate(Date expirationDate)
setExpirationDate in class VariantexpirationDate - The expiration date.public void setIdentifier(Reference identifier)
setIdentifier in class Variantidentifier - The official identifier.public void setIdentifier(String identifierUri)
setIdentifier in class VariantidentifierUri - The official identifier to parse.public void setMediaType(MediaType mediaType)
setMediaType in class VariantmediaType - The media type.public void setModificationDate(Date modificationDate)
setModificationDate in class VariantmodificationDate - The modification date.public void setSize(long expectedSize)
setSize in class VariantexpectedSize - The expected size in bytes if known, -1 otherwise.public void setTag(Tag tag)
setTag in class Varianttag - The tag.public void setTransient(boolean isTransient)
setTransient in class RepresentationisTransient - True if the representation's content is transient.
public void write(OutputStream outputStream)
throws IOException
write in class RepresentationoutputStream - The output stream.
IOException
public void write(WritableByteChannel writableChannel)
throws IOException
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 | |||||||||