public abstract class ResponseStream extends ToByteResponseStream
SIZE
Modifier | Constructor and Description |
---|---|
|
ResponseStream() |
protected |
ResponseStream(AbstractHttpResponse response) |
Modifier and Type | Method and Description |
---|---|
boolean |
canWrite()
Response stream is a writable stream.
|
void |
clear()
Clears the output buffer, including headers if possible.
|
void |
clearBuffer()
Clears the response buffer.
|
void |
clearClosed()
Clear the closed state, because of the NOT_MODIFIED
|
protected void |
clearNext() |
protected void |
closeImpl()
Complete the request.
|
protected void |
closeNext() |
protected abstract void |
closeNextImpl() |
void |
completeCache() |
protected java.lang.String |
dbgId() |
void |
flush()
Flushes the buffered response to the output stream.
|
void |
flushByte()
Flushes the buffered response to the output stream.
|
void |
flushChar()
Flushes the buffered response to the writer.
|
void |
flushNext()
Flushes the next buffer, leaving the current buffer alone
|
protected abstract void |
flushNextImpl() |
byte[] |
getBuffer()
Returns the byte buffer.
|
int |
getBufferOffset()
Returns the byte offset.
|
protected java.io.OutputStream |
getByteCacheStream()
Sets a byte cache stream.
|
CauchoResponse |
getCauchoResponse() |
int |
getContentLength()
Returns the written content length
|
protected abstract byte[] |
getNextBuffer() |
protected abstract int |
getNextBufferOffset() |
protected int |
getNextStartOffset() |
protected AbstractHttpResponse |
getResponse() |
boolean |
hasData() |
boolean |
isCauchoResponseStream()
Returns true for a Caucho response stream.
|
boolean |
isCloseComplete()
Test if the request is closing.
|
boolean |
isCommitted()
Test if data has been flushed to the client.
|
protected boolean |
isDisableAutoFlush() |
protected boolean |
isNextValid() |
void |
killCaching() |
byte[] |
nextBuffer(int offset)
Sets the next buffer
|
void |
setAutoFlush(boolean isAutoFlush)
Sets the auto-flush
|
void |
setBufferOffset(int offset)
Sets the byte offset.
|
void |
setBufferSize(int size)
Sets the buffer capacity.
|
void |
setByteCacheStream(java.io.OutputStream cacheStream)
Sets the underlying cache stream for a cached request.
|
protected boolean |
setFlush(boolean flush) |
protected void |
setNextBufferOffset(int offset) |
protected abstract void |
setNextBufferOffsetImpl(int offset) |
void |
setProxyCacheResponse(CauchoResponse response) |
void |
setResponse(AbstractHttpResponse response) |
void |
start()
initializes the Response stream at the beginning of a request.
|
protected void |
startCaching(boolean isByte)
Called to start caching.
|
java.lang.String |
toString() |
void |
write(int ch)
Writes a byte to the output.
|
protected void |
writeHeaders(int length)
Writes any http headers.
|
protected void |
writeNext(byte[] buf,
int offset,
int length,
boolean isFinished)
Writes the next chunk of data to the response stream.
|
protected byte[] |
writeNextBuffer(int offset) |
protected abstract byte[] |
writeNextBufferImpl(int offset) |
protected void |
writeTail(boolean isComplete) |
protected void |
writeTailImpl(boolean isClosed) |
flushBuffer, flushByteBuffer, flushCharBuffer, getBufferLength, getBufferSize, getByteBufferOffset, getCharBuffer, getCharOffset, getRemaining, isCharFlushing, nextCharBuffer, print, print, setCharOffset, setEncoding, setLocale, setOutputStreamOnly, write
close, getCharCacheStream, getEncoding, isAutoFlush, isClosed, isClosing, isHead, sendFile, setCauchoResponse, setCharCacheStream, setCommitted, setHead, toClosing
public ResponseStream()
protected ResponseStream(AbstractHttpResponse response)
public void setResponse(AbstractHttpResponse response)
protected AbstractHttpResponse getResponse()
public void setProxyCacheResponse(CauchoResponse response)
public CauchoResponse getCauchoResponse()
public void start()
start
in class ToByteResponseStream
public boolean isCauchoResponseStream()
isCauchoResponseStream
in class ToByteResponseStream
public void setByteCacheStream(java.io.OutputStream cacheStream)
setByteCacheStream
in class AbstractResponseStream
cacheStream
- the cache stream.protected java.io.OutputStream getByteCacheStream()
AbstractResponseStream
getByteCacheStream
in class AbstractResponseStream
public boolean canWrite()
protected boolean setFlush(boolean flush)
setFlush
in class ToByteResponseStream
public void setAutoFlush(boolean isAutoFlush)
AbstractResponseStream
setAutoFlush
in class AbstractResponseStream
protected boolean isDisableAutoFlush()
isDisableAutoFlush
in class ToByteResponseStream
public final int getContentLength()
AbstractResponseStream
getContentLength
in class ToByteResponseStream
public void setBufferSize(int size)
ToByteResponseStream
setBufferSize
in class ToByteResponseStream
public boolean hasData()
public boolean isCommitted()
AbstractResponseStream
isCommitted
in class AbstractResponseStream
public void clear() throws java.io.IOException
AbstractResponseStream
clear
in class AbstractResponseStream
java.io.IOException
public void clearBuffer()
ToByteResponseStream
clearBuffer
in class ToByteResponseStream
public boolean isCloseComplete()
AbstractResponseStream
isCloseComplete
in class AbstractResponseStream
public void clearClosed()
protected void writeHeaders(int length) throws java.io.IOException
ToByteResponseStream
writeHeaders
in class ToByteResponseStream
length
- the current buffer lengthjava.io.IOException
public final void write(int ch) throws java.io.IOException
ToByteResponseStream
write
in interface ByteAppendable
write
in class ToByteResponseStream
java.io.IOException
public final byte[] getBuffer() throws java.io.IOException
getBuffer
in class ToByteResponseStream
java.io.IOException
public final int getBufferOffset() throws java.io.IOException
getBufferOffset
in class ToByteResponseStream
java.io.IOException
public final void setBufferOffset(int offset) throws java.io.IOException
setBufferOffset
in class ToByteResponseStream
java.io.IOException
public final byte[] nextBuffer(int offset) throws java.io.IOException
nextBuffer
in class ToByteResponseStream
java.io.IOException
protected final void writeNext(byte[] buf, int offset, int length, boolean isFinished) throws java.io.IOException
writeNext
in class ToByteResponseStream
buf
- the buffer containing the dataoffset
- start offset into the bufferlength
- length of the data in the bufferjava.io.IOException
public final void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class ToByteResponseStream
java.io.IOException
public void flushByte() throws java.io.IOException
flushByte
in class AbstractResponseStream
java.io.IOException
public void flushChar() throws java.io.IOException
flushChar
in class AbstractResponseStream
java.io.IOException
protected void closeImpl() throws java.io.IOException
closeImpl
in class ToByteResponseStream
java.io.IOException
protected void startCaching(boolean isByte)
public void killCaching()
killCaching
in class AbstractResponseStream
public void completeCache()
completeCache
in class AbstractResponseStream
protected final boolean isNextValid()
protected void clearNext()
protected abstract byte[] getNextBuffer()
protected int getNextStartOffset()
protected abstract int getNextBufferOffset() throws java.io.IOException
java.io.IOException
protected final void setNextBufferOffset(int offset) throws java.io.IOException
java.io.IOException
protected abstract void setNextBufferOffsetImpl(int offset) throws java.io.IOException
java.io.IOException
protected final byte[] writeNextBuffer(int offset) throws java.io.IOException
java.io.IOException
protected abstract byte[] writeNextBufferImpl(int offset) throws java.io.IOException
java.io.IOException
public final void flushNext() throws java.io.IOException
AbstractResponseStream
flushNext
in class AbstractResponseStream
java.io.IOException
protected abstract void flushNextImpl() throws java.io.IOException
java.io.IOException
protected final void closeNext() throws java.io.IOException
java.io.IOException
protected abstract void closeNextImpl() throws java.io.IOException
java.io.IOException
protected final void writeTail(boolean isComplete) throws java.io.IOException
java.io.IOException
protected void writeTailImpl(boolean isClosed) throws java.io.IOException
java.io.IOException
protected java.lang.String dbgId()
public java.lang.String toString()
toString
in class AbstractResponseStream