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.
|
ReadableByteChannel |
getChannel()
Deprecated.
|
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.
|
InputStream |
getStream()
Returns a stream with the representation's content.
|
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(OutputStream outputStream)
Writes the representation to a byte stream.
|
void |
write(WritableByteChannel writableChannel)
Deprecated.
|
void |
write(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()
@Deprecated public ReadableByteChannel getChannel() throws IOException
RepresentationgetChannel in class WrapperRepresentationIOExceptionpublic Reader getReader() throws IOException
RepresentationgetReader in class WrapperRepresentationIOExceptionpublic long getSize()
RepresentationRepresentation.getAvailableSize() method.getSize in class WrapperRepresentationRepresentation.isEmpty()public InputStream getStream() throws IOException
RepresentationgetStream in class WrapperRepresentationIOExceptionpublic String getText() throws IOException
RepresentationgetText in class WrapperRepresentationIOExceptionpublic 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(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.IOException@Deprecated public void write(WritableByteChannel writableChannel) throws IOException
Representationwrite in class WrapperRepresentationwritableChannel - A writable byte channel.IOExceptionpublic 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.IOExceptionCopyright © 2005–2025. All rights reserved.