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, writeclose, getCharCacheStream, getEncoding, isAutoFlush, isClosed, isClosing, isHead, sendFile, setCauchoResponse, setCharCacheStream, setCommitted, setHead, toClosingpublic 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 ToByteResponseStreampublic boolean isCauchoResponseStream()
isCauchoResponseStream in class ToByteResponseStreampublic void setByteCacheStream(java.io.OutputStream cacheStream)
setByteCacheStream in class AbstractResponseStreamcacheStream - the cache stream.protected java.io.OutputStream getByteCacheStream()
AbstractResponseStreamgetByteCacheStream in class AbstractResponseStreampublic boolean canWrite()
protected boolean setFlush(boolean flush)
setFlush in class ToByteResponseStreampublic void setAutoFlush(boolean isAutoFlush)
AbstractResponseStreamsetAutoFlush in class AbstractResponseStreamprotected boolean isDisableAutoFlush()
isDisableAutoFlush in class ToByteResponseStreampublic final int getContentLength()
AbstractResponseStreamgetContentLength in class ToByteResponseStreampublic void setBufferSize(int size)
ToByteResponseStreamsetBufferSize in class ToByteResponseStreampublic boolean hasData()
public boolean isCommitted()
AbstractResponseStreamisCommitted in class AbstractResponseStreampublic void clear()
throws java.io.IOException
AbstractResponseStreamclear in class AbstractResponseStreamjava.io.IOExceptionpublic void clearBuffer()
ToByteResponseStreamclearBuffer in class ToByteResponseStreampublic boolean isCloseComplete()
AbstractResponseStreamisCloseComplete in class AbstractResponseStreampublic void clearClosed()
protected void writeHeaders(int length)
throws java.io.IOException
ToByteResponseStreamwriteHeaders in class ToByteResponseStreamlength - the current buffer lengthjava.io.IOExceptionpublic final void write(int ch)
throws java.io.IOException
ToByteResponseStreamwrite in interface ByteAppendablewrite in class ToByteResponseStreamjava.io.IOExceptionpublic final byte[] getBuffer()
throws java.io.IOException
getBuffer in class ToByteResponseStreamjava.io.IOExceptionpublic final int getBufferOffset()
throws java.io.IOException
getBufferOffset in class ToByteResponseStreamjava.io.IOExceptionpublic final void setBufferOffset(int offset)
throws java.io.IOException
setBufferOffset in class ToByteResponseStreamjava.io.IOExceptionpublic final byte[] nextBuffer(int offset)
throws java.io.IOException
nextBuffer in class ToByteResponseStreamjava.io.IOExceptionprotected final void writeNext(byte[] buf,
int offset,
int length,
boolean isFinished)
throws java.io.IOException
writeNext in class ToByteResponseStreambuf - the buffer containing the dataoffset - start offset into the bufferlength - length of the data in the bufferjava.io.IOExceptionpublic final void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class ToByteResponseStreamjava.io.IOExceptionpublic void flushByte()
throws java.io.IOException
flushByte in class AbstractResponseStreamjava.io.IOExceptionpublic void flushChar()
throws java.io.IOException
flushChar in class AbstractResponseStreamjava.io.IOExceptionprotected void closeImpl()
throws java.io.IOException
closeImpl in class ToByteResponseStreamjava.io.IOExceptionprotected void startCaching(boolean isByte)
public void killCaching()
killCaching in class AbstractResponseStreampublic void completeCache()
completeCache in class AbstractResponseStreamprotected final boolean isNextValid()
protected void clearNext()
protected abstract byte[] getNextBuffer()
protected int getNextStartOffset()
protected abstract int getNextBufferOffset()
throws java.io.IOException
java.io.IOExceptionprotected final void setNextBufferOffset(int offset)
throws java.io.IOException
java.io.IOExceptionprotected abstract void setNextBufferOffsetImpl(int offset)
throws java.io.IOException
java.io.IOExceptionprotected final byte[] writeNextBuffer(int offset)
throws java.io.IOException
java.io.IOExceptionprotected abstract byte[] writeNextBufferImpl(int offset)
throws java.io.IOException
java.io.IOExceptionpublic final void flushNext()
throws java.io.IOException
AbstractResponseStreamflushNext in class AbstractResponseStreamjava.io.IOExceptionprotected abstract void flushNextImpl()
throws java.io.IOException
java.io.IOExceptionprotected final void closeNext()
throws java.io.IOException
java.io.IOExceptionprotected abstract void closeNextImpl()
throws java.io.IOException
java.io.IOExceptionprotected final void writeTail(boolean isComplete)
throws java.io.IOException
java.io.IOExceptionprotected void writeTailImpl(boolean isClosed)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String dbgId()
public java.lang.String toString()
toString in class AbstractResponseStream