org.restlet.engine.io
Class BufferingRepresentation
java.lang.Object
org.restlet.representation.Variant
org.restlet.representation.RepresentationInfo
org.restlet.representation.Representation
org.restlet.util.WrapperRepresentation
org.restlet.engine.io.BufferingRepresentation
public class BufferingRepresentation
- extends WrapperRepresentation
Representation capable of buffering the wrapped representation. This is
useful when you want to prevent chunk encoding from being used for dynamic
representations or when you want to reuse a transient representation several
times.
Be careful as this class could create potentially very large byte buffers in
memory that could impact your application performance.
- Author:
- Thierry Boileau
Methods inherited from class org.restlet.util.WrapperRepresentation |
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 |
BufferingRepresentation
public BufferingRepresentation(Representation bufferedRepresentation)
- Constructor.
- Parameters:
bufferedRepresentation
- The representation to buffer.
getAvailableSize
public long getAvailableSize()
- Overrides:
getAvailableSize
in class WrapperRepresentation
getBuffer
protected byte[] getBuffer()
- Returns the buffered content as an array of bytes.
- Returns:
- The buffered content as an array of bytes.
getChannel
public ReadableByteChannel getChannel()
throws IOException
- Overrides:
getChannel
in class WrapperRepresentation
- Throws:
IOException
getReader
public Reader getReader()
throws IOException
- Overrides:
getReader
in class WrapperRepresentation
- Throws:
IOException
getSize
public long getSize()
- Overrides:
getSize
in class WrapperRepresentation
getStream
public InputStream getStream()
throws IOException
- Overrides:
getStream
in class WrapperRepresentation
- Throws:
IOException
getText
public String getText()
throws IOException
- Overrides:
getText
in class WrapperRepresentation
- Throws:
IOException
isAvailable
public boolean isAvailable()
- Overrides:
isAvailable
in class WrapperRepresentation
isBuffered
protected boolean isBuffered()
- Indicates if the wrapped entity has been already buffered.
- Returns:
- True if the wrapped entity has been already buffered.
setBuffer
protected void setBuffer(byte[] buffer)
- Sets the buffered content as an array of bytes.
- Parameters:
buffer
- The buffered content as an array of bytes.
setBuffered
protected void setBuffered(boolean buffered)
- Indicates if the wrapped entity has been already buffered.
- Parameters:
buffered
- True if the wrapped entity has been already buffered.
write
public void write(OutputStream outputStream)
throws IOException
- Overrides:
write
in class WrapperRepresentation
- Throws:
IOException
write
public void write(WritableByteChannel writableChannel)
throws IOException
- Overrides:
write
in class WrapperRepresentation
- Throws:
IOException
write
public void write(Writer writer)
throws IOException
- Overrides:
write
in class WrapperRepresentation
- Throws:
IOException
Copyright © 2005-2013 Restlet.