public class RangeRepresentation extends WrapperRepresentation
UNKNOWN_SIZE| Constructor and Description |
|---|
RangeRepresentation(Representation wrappedRepresentation)
Constructor.
|
RangeRepresentation(Representation wrappedRepresentation,
Range range)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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. |
Range |
getRange()
Returns the range specific to this wrapper.
|
Reader |
getReader()
Returns a characters reader with the representation's content.
|
InputStream |
getStream()
Returns a stream with the representation's content.
|
String |
getText()
Converts the representation to a string value.
|
void |
setRange(Range range)
Sets the range specific to this wrapper.
|
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.
|
exhaust, getCharacterSet, getDigest, getDisposition, getEncodings, getExpirationDate, getLanguages, getLocationRef, getMediaType, getModificationDate, getRegistration, getSize, getTag, getWrappedRepresentation, isAvailable, isSelectable, isTransient, release, setAvailable, setCharacterSet, setDigest, setDisposition, setEncodings, setExpirationDate, setLanguages, setLocationRef, setLocationRef, setMediaType, setModificationDate, setSize, setTag, setTransientappend, hasKnownSize, isEmpty, setListenercreateClientInfo, equals, includes, isCompatible, toStringpublic RangeRepresentation(Representation wrappedRepresentation)
wrappedRepresentation - The wrapped representation with a complete content.public RangeRepresentation(Representation wrappedRepresentation, Range range)
wrappedRepresentation - The wrapped representation with a complete content.range - The range to expose.public long getAvailableSize()
RepresentationRepresentation.getSize() if no range is defined, otherwise it returns the size
of the range using Range.getSize().getAvailableSize in class WrapperRepresentationpublic ReadableByteChannel getChannel() throws IOException
RepresentationgetChannel in class WrapperRepresentationIOExceptionpublic Range getRange()
getRange in class WrapperRepresentationpublic Reader getReader() throws IOException
RepresentationgetReader in class WrapperRepresentationIOExceptionpublic InputStream getStream() throws IOException
RepresentationgetStream in class WrapperRepresentationIOExceptionpublic String getText() throws IOException
RepresentationgetText in class WrapperRepresentationIOExceptionpublic void setRange(Range range)
setRange in class WrapperRepresentationrange - The range specific to this wrapper.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 WrapperRepresentationwriter - The characters writer.IOExceptionpublic void write(OutputStream outputStream) throws IOException
RepresentationOutputStream after writing to it as this will be handled by
the Restlet connectors automatically.write in class WrapperRepresentationoutputStream - The output stream.IOExceptionpublic void write(WritableByteChannel writableChannel) throws IOException
Representationwrite in class WrapperRepresentationwritableChannel - A writable byte channel.IOExceptionCopyright © 2005-2016 Restlet.