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, setTransient
append, hasKnownSize, isEmpty, setListener
createClientInfo, equals, hashCode, includes, isCompatible, toString
public BufferingRepresentation(Representation bufferedRepresentation)
bufferedRepresentation
- The representation to buffer.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 WrapperRepresentation
protected byte[] getBuffer()
public java.nio.channels.ReadableByteChannel getChannel() throws java.io.IOException
Representation
getChannel
in class WrapperRepresentation
java.io.IOException
public java.io.Reader getReader() throws java.io.IOException
Representation
getReader
in class WrapperRepresentation
java.io.IOException
public long getSize()
Representation
Representation.getAvailableSize()
method.getSize
in class WrapperRepresentation
Representation.isEmpty()
public java.io.InputStream getStream() throws java.io.IOException
Representation
getStream
in class WrapperRepresentation
java.io.IOException
public java.lang.String getText() throws java.io.IOException
Representation
getText
in class WrapperRepresentation
java.io.IOException
public boolean isAvailable()
Representation
isAvailable
in class WrapperRepresentation
protected 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
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
Representation
write
in class WrapperRepresentation
writableChannel
- A writable byte channel.java.io.IOException
public void write(java.io.Writer writer) throws java.io.IOException
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
Copyright © 2005-2024 Restlet.