|
||||||||||
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.Representation |
---|
UNKNOWN_SIZE |
Constructor Summary | |
---|---|
WrapperRepresentation(Representation wrappedRepresentation)
Constructor. |
Method Summary | |
---|---|
boolean |
checkDigest()
Check that the digest computed from the representation content and the digest declared by the representation are the same. Since this method relies on the Representation.computeDigest(String) method,
and since this method reads entirely the representation's stream, user
must take care of the content of the representation in case the latter is
transient. |
boolean |
checkDigest(java.lang.String algorithm)
Check that the digest computed from the representation content and the digest declared by the representation are the same. |
Digest |
computeDigest(java.lang.String algorithm)
Compute the representation digest according to the given algorithm. Since this method reads entirely the representation's stream, user must take care of the content of the representation in case the latter is transient. |
long |
exhaust()
Exhauts the content of the representation by reading it and silently discarding anything read. |
long |
getAvailableSize()
Returns the size effectively available. |
java.nio.channels.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. |
java.lang.String |
getDownloadName()
Returns the suggested download file name for this representation. |
java.util.List<Encoding> |
getEncodings()
Returns the modifiable list of encodings applied to the entity-body. |
java.util.Date |
getExpirationDate()
Returns the future date when this representation expire. |
Reference |
getIdentifier()
Returns an optional identifier. |
java.util.List<Language> |
getLanguages()
Returns the modifiable list of languages. |
MediaType |
getMediaType()
Returns the media type. |
java.util.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. |
java.io.Reader |
getReader()
Returns a characters reader with the representation's content. |
long |
getSize()
Returns the size in bytes if known, UNKNOWN_SIZE (-1) otherwise. |
java.io.InputStream |
getStream()
Returns a stream with the representation's content. |
Tag |
getTag()
Returns the tag. |
java.lang.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 |
isDownloadable()
Indicates if the representation is downloadable which means that it can be obtained via a download dialog box. |
boolean |
isTransient()
Indicates if the representation's content is transient, which means that it can be obtained only once. |
void |
release()
Releases the representation's content and all associated objects like sockets, channels or files. |
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 |
setDigest(Digest digest)
Sets the representation digest. |
void |
setDownloadable(boolean downloadable)
Indicates if the representation is downloadable which means that it can be obtained via a download dialog box. |
void |
setDownloadName(java.lang.String fileName)
Set the suggested download file name for this representation. |
void |
setEncodings(java.util.List<Encoding> encodings)
Sets the list of encodings applied to the entity-body. |
void |
setExpirationDate(java.util.Date expirationDate)
Sets the future date when this representation expire. |
void |
setIdentifier(Reference identifier)
Sets the optional identifier. |
void |
setIdentifier(java.lang.String identifierUri)
Sets the identifier from a URI string. |
void |
setLanguages(java.util.List<Language> languages)
Sets the list of languages. |
void |
setMediaType(MediaType mediaType)
Sets the media type. |
void |
setModificationDate(java.util.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. |
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(java.io.OutputStream outputStream)
Writes the representation to a byte stream. |
void |
write(java.nio.channels.WritableByteChannel writableChannel)
Writes the representation to a byte channel. |
void |
write(java.io.Writer writer)
Writes the representation to a characters writer. |
Methods inherited from class org.restlet.resource.Representation |
---|
createEmpty |
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 boolean checkDigest()
Representation
Representation.computeDigest(String)
method,
and since this method reads entirely the representation's stream, user
must take care of the content of the representation in case the latter is
transient.
Representation.isTransient
checkDigest
in class Representation
public boolean checkDigest(java.lang.String algorithm)
Representation
Representation.computeDigest(String)
method,
and since this method reads entirely the representation's stream, user
must take care of the content of the representation in case the latter is
transient.
Representation.isTransient
checkDigest
in class Representation
algorithm
- The algorithm used to compute the digest to compare with. See
constant values in Digest
.
public Digest computeDigest(java.lang.String algorithm)
Representation
Representation.isTransient
computeDigest
in class Representation
algorithm
- The algorithm used to compute the digest. See constant values
in Digest
.
public long exhaust() throws java.io.IOException
Representation
exhaust
in class Representation
java.io.IOException
public long getAvailableSize()
Representation
Representation.getSize()
if no range is defined, otherwise it returns the size
of the range using Range.getSize()
.
getAvailableSize
in class Representation
public java.nio.channels.ReadableByteChannel getChannel() throws java.io.IOException
Representation
getChannel
in class Representation
java.io.IOException
public CharacterSet getCharacterSet()
Variant
getCharacterSet
in class Variant
public Digest getDigest()
Representation
getDigest
in class Representation
public java.lang.String getDownloadName()
Representation
getDownloadName
in class Representation
public java.util.List<Encoding> getEncodings()
Variant
getEncodings
in class Variant
public java.util.Date getExpirationDate()
Representation
getExpirationDate
in class Representation
public Reference getIdentifier()
Variant
getIdentifier
in class Variant
public java.util.List<Language> getLanguages()
Variant
getLanguages
in class Variant
public MediaType getMediaType()
Variant
getMediaType
in class Variant
public java.util.Date getModificationDate()
Representation
getModificationDate
in class Representation
public Range getRange()
Representation
getRange
in class Representation
public java.io.Reader getReader() throws java.io.IOException
Representation
getReader
in class Representation
java.io.IOException
public long getSize()
Representation
getSize
in class Representation
public java.io.InputStream getStream() throws java.io.IOException
Representation
getStream
in class Representation
java.io.IOException
public Tag getTag()
Representation
getTag
in class Representation
public java.lang.String getText() throws java.io.IOException
Representation
getText
in class Representation
java.io.IOException
public Representation getWrappedRepresentation()
public boolean isAvailable()
Representation
isAvailable
in class Representation
public boolean isDownloadable()
Representation
isDownloadable
in class Representation
public boolean isTransient()
Representation
isTransient
in class Representation
public void release()
Representation
release
in class Representation
public void setAvailable(boolean isAvailable)
Representation
setAvailable
in class Representation
isAvailable
- True if some fresh content is available.public void setCharacterSet(CharacterSet characterSet)
Variant
setCharacterSet
in class Variant
characterSet
- The character set or null if not applicable.public void setDigest(Digest digest)
Representation
setDigest
in class Representation
digest
- The representation digest.public void setDownloadable(boolean downloadable)
Representation
setDownloadable
in class Representation
downloadable
- True if the representation's content is downloadable.public void setDownloadName(java.lang.String fileName)
Representation
setDownloadName
in class Representation
fileName
- The suggested file name.public void setEncodings(java.util.List<Encoding> encodings)
Variant
setEncodings
in class Variant
encodings
- The list of encodings applied to the entity-body.public void setExpirationDate(java.util.Date expirationDate)
Representation
setExpirationDate
in class Representation
expirationDate
- The expiration date.public void setIdentifier(Reference identifier)
Variant
setIdentifier
in class Variant
identifier
- The identifier.public void setIdentifier(java.lang.String identifierUri)
Variant
setIdentifier
in class Variant
identifierUri
- The identifier to parse.public void setLanguages(java.util.List<Language> languages)
Variant
setLanguages
in class Variant
languages
- The list of languages.public void setMediaType(MediaType mediaType)
Variant
setMediaType
in class Variant
mediaType
- The media type.public void setModificationDate(java.util.Date modificationDate)
Representation
setModificationDate
in class Representation
modificationDate
- The modification date.public void setRange(Range range)
Representation
setRange
in class Representation
range
- The content range.public void setSize(long expectedSize)
Representation
setSize
in class Representation
expectedSize
- The expected size in bytes if known, -1 otherwise.public void setTag(Tag tag)
Representation
setTag
in class Representation
tag
- The tag.public void setTransient(boolean isTransient)
Representation
setTransient
in class Representation
isTransient
- True if the representation's content is transient.public void write(java.io.OutputStream outputStream) throws java.io.IOException
Representation
write
in class Representation
outputStream
- The output stream.
java.io.IOException
public void write(java.nio.channels.WritableByteChannel writableChannel) throws java.io.IOException
Representation
write
in class Representation
writableChannel
- A writable byte channel.
java.io.IOException
public void write(java.io.Writer writer) throws java.io.IOException
Representation
write
in class Representation
writer
- The characters writer.
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |