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.
|
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. |
Range |
getRange()
Returns the range specific to this wrapper.
|
java.io.Reader |
getReader()
Returns a characters reader with the representation's content.
|
java.io.InputStream |
getStream()
Returns a stream with the representation's content.
|
java.lang.String |
getText()
Converts the representation to a string value.
|
void |
setRange(Range range)
Sets the range specific to this wrapper.
|
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.
|
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, setTransient
append, hasKnownSize, isEmpty, setListener
createClientInfo, equals, hashCode, includes, isCompatible, toString
public 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()
org.restlet.representation.Representation
Representation.getSize()
if no range is defined, otherwise it returns the size
of the range using Range.getSize()
.getAvailableSize
in class WrapperRepresentation
public java.nio.channels.ReadableByteChannel getChannel() throws java.io.IOException
org.restlet.representation.Representation
getChannel
in class WrapperRepresentation
java.io.IOException
public Range getRange()
getRange
in class WrapperRepresentation
public java.io.Reader getReader() throws java.io.IOException
org.restlet.representation.Representation
getReader
in class WrapperRepresentation
java.io.IOException
public java.io.InputStream getStream() throws java.io.IOException
org.restlet.representation.Representation
getStream
in class WrapperRepresentation
java.io.IOException
public java.lang.String getText() throws java.io.IOException
org.restlet.representation.Representation
getText
in class WrapperRepresentation
java.io.IOException
public void setRange(Range range)
setRange
in class WrapperRepresentation
range
- The range specific to this wrapper.public void write(java.io.Writer writer) throws java.io.IOException
org.restlet.representation.Representation
Writer
after writing to it as this will be handled
by the Restlet connectors automatically.write
in class WrapperRepresentation
writer
- The characters writer.java.io.IOException
public void write(java.io.OutputStream outputStream) throws java.io.IOException
org.restlet.representation.Representation
OutputStream
after writing to it as this will be handled by
the Restlet connectors automatically.write
in class WrapperRepresentation
outputStream
- The output stream.java.io.IOException
public void write(java.nio.channels.WritableByteChannel writableChannel) throws java.io.IOException
org.restlet.representation.Representation
write
in class WrapperRepresentation
writableChannel
- A writable byte channel.java.io.IOException
Copyright © 2005-2020 Restlet.