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
Method Summary |
long |
getAvailableSize()
|
protected byte[] |
getBuffer()
Returns the buffered content as an array of bytes. |
java.nio.channels.ReadableByteChannel |
getChannel()
|
long |
getSize()
|
java.io.InputStream |
getStream()
|
java.lang.String |
getText()
|
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)
|
void |
write(java.io.Writer writer)
|
Methods inherited from class org.restlet.util.WrapperRepresentation |
exhaust, getCharacterSet, getDigest, getDisposition, getEncodings, getExpirationDate, getLanguages, getLocationRef, getMediaType, getModificationDate, getRange, getReader, getRegistration, getTag, getWrappedRepresentation, isAvailable, isSelectable, isTransient, release, setAvailable, setCharacterSet, setDigest, setDisposition, setEncodings, setExpirationDate, setLanguages, setLocationRef, setLocationRef, setMediaType, setModificationDate, setRange, setSize, setTag, setTransient, write |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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 java.nio.channels.ReadableByteChannel getChannel()
throws java.io.IOException
- Overrides:
getChannel
in class WrapperRepresentation
- Throws:
java.io.IOException
getSize
public long getSize()
- Overrides:
getSize
in class WrapperRepresentation
getStream
public java.io.InputStream getStream()
throws java.io.IOException
- Overrides:
getStream
in class WrapperRepresentation
- Throws:
java.io.IOException
getText
public java.lang.String getText()
throws java.io.IOException
- Overrides:
getText
in class WrapperRepresentation
- Throws:
java.io.IOException
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(java.io.OutputStream outputStream)
throws java.io.IOException
- Overrides:
write
in class WrapperRepresentation
- Throws:
java.io.IOException
write
public void write(java.io.Writer writer)
throws java.io.IOException
- Overrides:
write
in class WrapperRepresentation
- Throws:
java.io.IOException
Copyright © 2005-2013 Restlet S.A.S..