|
||||||||||
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 Representation
IOException
public CharacterSet getCharacterSet()
getCharacterSet
in class Variant
public List<Encoding> getEncodings()
getEncodings
in class Variant
public Date getExpirationDate()
getExpirationDate
in class Variant
public Reference getIdentifier()
getIdentifier
in class Variant
public List<Language> getLanguages()
getLanguages
in class Variant
public MediaType getMediaType()
getMediaType
in class Variant
public Date getModificationDate()
getModificationDate
in class Variant
public long getSize()
getSize
in class Variant
public InputStream getStream() throws IOException
getStream
in class Representation
IOException
public Tag getTag()
getTag
in class Variant
public String getText() throws IOException
getText
in class Representation
IOException
public Representation getWrappedRepresentation()
public boolean isAvailable()
isAvailable
in class Representation
public boolean isTransient()
isTransient
in class Representation
public void setAvailable(boolean isAvailable)
setAvailable
in class Representation
isAvailable
- True if some fresh content is available.public void setCharacterSet(CharacterSet characterSet)
setCharacterSet
in class Variant
characterSet
- The character set or null if not applicable.public void setExpirationDate(Date expirationDate)
setExpirationDate
in class Variant
expirationDate
- The expiration date.public void setIdentifier(Reference identifier)
setIdentifier
in class Variant
identifier
- The official identifier.public void setIdentifier(String identifierUri)
setIdentifier
in class Variant
identifierUri
- The official identifier to parse.public void setMediaType(MediaType mediaType)
setMediaType
in class Variant
mediaType
- The media type.public void setModificationDate(Date modificationDate)
setModificationDate
in class Variant
modificationDate
- The modification date.public void setSize(long expectedSize)
setSize
in class Variant
expectedSize
- The expected size in bytes if known, -1 otherwise.public void setTag(Tag tag)
setTag
in class Variant
tag
- The tag.public void setTransient(boolean isTransient)
setTransient
in class Representation
isTransient
- True if the representation's content is transient.public void write(OutputStream outputStream) throws IOException
write
in class Representation
outputStream
- The output stream.
IOException
public void write(WritableByteChannel writableChannel) throws IOException
write
in class Representation
writableChannel
- A writable byte channel.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |