public class BufferingRepresentation extends WrapperRepresentation
UNKNOWN_SIZE| Constructor and Description |
|---|
BufferingRepresentation(Representation bufferedRepresentation)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getAvailableSize()
Returns the size effectively available.
|
protected byte[] |
getBuffer()
Returns the buffered content as an array of bytes.
|
java.nio.channels.ReadableByteChannel |
getChannel()
Returns a channel with the representation's content.
|
java.io.Reader |
getReader()
Returns a characters reader with the representation's content.
|
long |
getSize()
Returns the total size in bytes if known, UNKNOWN_SIZE (-1) otherwise.
|
java.io.InputStream |
getStream()
Returns a stream with the representation's content.
|
java.lang.String |
getText()
Converts the representation to a string value.
|
boolean |
isAvailable()
Indicates if some fresh content is potentially available, without having
to actually call one of the content manipulation method like getStream()
that would actually consume it.
|
protected boolean |
isBuffered()
Indicates if the wrapped entity has been already buffered.
|
protected void |
setBuffer(byte[] buffer)
Sets the buffered content as an array of bytes.
|
protected void |
setBuffered(boolean buffered)
Indicates if the wrapped entity has been already buffered.
|
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, getRange, getRegistration, getTag, getWrappedRepresentation, isSelectable, isTransient, release, setAvailable, setCharacterSet, setDigest, setDisposition, setEncodings, setExpirationDate, setLanguages, setLocationRef, setLocationRef, setMediaType, setModificationDate, setRange, setSize, setTag, setTransientappend, hasKnownSize, isEmpty, setListenercreateClientInfo, equals, hashCode, includes, isCompatible, toStringpublic BufferingRepresentation(Representation bufferedRepresentation)
bufferedRepresentation - The representation to buffer.public long getAvailableSize()
RepresentationRepresentation.getSize() if no range is defined, otherwise it returns the size
of the range using Range.getSize().getAvailableSize in class WrapperRepresentationprotected byte[] getBuffer()
public java.nio.channels.ReadableByteChannel getChannel()
throws java.io.IOException
RepresentationgetChannel in class WrapperRepresentationjava.io.IOExceptionpublic java.io.Reader getReader()
throws java.io.IOException
RepresentationgetReader in class WrapperRepresentationjava.io.IOExceptionpublic long getSize()
RepresentationRepresentation.getAvailableSize() method.getSize in class WrapperRepresentationRepresentation.isEmpty()public java.io.InputStream getStream()
throws java.io.IOException
RepresentationgetStream in class WrapperRepresentationjava.io.IOExceptionpublic java.lang.String getText()
throws java.io.IOException
RepresentationgetText in class WrapperRepresentationjava.io.IOExceptionpublic boolean isAvailable()
RepresentationisAvailable in class WrapperRepresentationprotected boolean isBuffered()
protected void setBuffer(byte[] buffer)
buffer - The buffered content as an array of bytes.protected void setBuffered(boolean buffered)
buffered - True if the wrapped entity has been already buffered.public void write(java.io.OutputStream outputStream)
throws java.io.IOException
RepresentationOutputStream after writing to it as this will be handled by
the Restlet connectors automatically.write in class WrapperRepresentationoutputStream - The output stream.java.io.IOExceptionpublic void write(java.nio.channels.WritableByteChannel writableChannel)
throws java.io.IOException
Representationwrite in class WrapperRepresentationwritableChannel - A writable byte channel.java.io.IOExceptionpublic void write(java.io.Writer writer)
throws java.io.IOException
RepresentationWriter after writing to it as this will be handled
by the Restlet connectors automatically.write in class WrapperRepresentationwriter - The characters writer.java.io.IOExceptionCopyright © 2005-2024 Restlet.