|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
com.caucho.vfs.OutputStreamWithBuffer
com.caucho.server.http.AbstractResponseStream
com.caucho.server.http.ToByteResponseStream
public abstract class ToByteResponseStream
Handles the dual char/byte buffering for the response stream.
| Field Summary | |
|---|---|
protected static int |
SIZE
|
| Constructor Summary | |
|---|---|
protected |
ToByteResponseStream()
|
| Method Summary | |
|---|---|
void |
clearBuffer()
Clears the response buffer. |
protected void |
closeImpl()
Closes the response stream. |
void |
flush()
Flushes the buffered response to the output stream. |
void |
flushBuffer()
Flushes the buffer. |
protected void |
flushByteBuffer()
Flushes the buffered response to the output stream. |
protected void |
flushCharBuffer()
Converts the char buffer. |
byte[] |
getBuffer()
Returns the byte buffer. |
protected int |
getBufferLength()
Returns the data in the buffer |
int |
getBufferOffset()
Returns the byte offset. |
int |
getBufferSize()
Returns the buffer capacity. |
int |
getByteBufferOffset()
Returns the byte offset. |
char[] |
getCharBuffer()
Returns the char buffer. |
int |
getCharOffset()
Returns the char offset. |
int |
getContentLength()
Returns the written content length |
int |
getRemaining()
Returns the remaining value left. |
boolean |
isCauchoResponseStream()
Returns true for a caucho response stream. |
protected boolean |
isCharFlushing()
True while the char buffer is being flushed, needed for content-length vs chunked headers. |
protected boolean |
isDisableAutoFlush()
|
byte[] |
nextBuffer(int offset)
Returns the next byte buffer. |
char[] |
nextCharBuffer(int offset)
Converts the char buffer. |
void |
print(char[] buffer,
int offset,
int length)
Writes a char array to the output. |
void |
print(int ch)
Writes a character to the output. |
void |
setBufferOffset(int offset)
Sets the byte offset. |
void |
setBufferSize(int size)
Sets the buffer capacity. |
void |
setCharOffset(int offset)
Sets the char offset. |
void |
setEncoding(java.lang.String encoding)
Sets the encoding. |
protected boolean |
setFlush(boolean isAllowFlush)
|
void |
setLocale(java.util.Locale locale)
Sets the locale. |
void |
setOutputStreamOnly(boolean isOutputStreamOnly)
Set true for output stream only request. |
void |
start()
Initializes the Buffered Response stream at the beginning of a request. |
void |
write(byte[] buffer,
int offset,
int length)
Writes a chunk of bytes to the stream. |
void |
write(int ch)
Writes a byte to the output. |
protected void |
writeHeaders(int length)
Writes any http headers. |
protected abstract void |
writeNext(byte[] buffer,
int offset,
int length,
boolean isEnd)
Writes the chunk to the downward stream. |
| Methods inherited from class com.caucho.server.http.AbstractResponseStream |
|---|
clear, close, completeCache, flushByte, flushChar, flushNext, getByteCacheStream, getCharCacheStream, getEncoding, isAutoFlush, isCloseComplete, isClosed, isClosing, isCommitted, isHead, killCaching, sendFile, setAutoFlush, setByteCacheStream, setCauchoResponse, setCharCacheStream, setCommitted, setHead, toClosing, toString |
| Methods inherited from class java.io.OutputStream |
|---|
write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final int SIZE
| Constructor Detail |
|---|
protected ToByteResponseStream()
| Method Detail |
|---|
public void start()
start in class AbstractResponseStreampublic boolean isCauchoResponseStream()
isCauchoResponseStream in class AbstractResponseStreampublic void setOutputStreamOnly(boolean isOutputStreamOnly)
AbstractResponseStream
setOutputStreamOnly in class AbstractResponseStreamprotected boolean setFlush(boolean isAllowFlush)
public void setEncoding(java.lang.String encoding)
throws java.io.UnsupportedEncodingException
setEncoding in class AbstractResponseStreamjava.io.UnsupportedEncodingException
public void setLocale(java.util.Locale locale)
throws java.io.UnsupportedEncodingException
setLocale in class AbstractResponseStreamjava.io.UnsupportedEncodingExceptionpublic final char[] getCharBuffer()
getCharBuffer in class AbstractResponseStream
public int getCharOffset()
throws java.io.IOException
getCharOffset in class AbstractResponseStreamjava.io.IOException
public void setCharOffset(int offset)
throws java.io.IOException
setCharOffset in class AbstractResponseStreamjava.io.IOException
public byte[] getBuffer()
throws java.io.IOException
getBuffer in class OutputStreamWithBufferjava.io.IOException
public int getBufferOffset()
throws java.io.IOException
getBufferOffset in class OutputStreamWithBufferjava.io.IOException
public int getByteBufferOffset()
throws java.io.IOException
java.io.IOException
public void setBufferOffset(int offset)
throws java.io.IOException
setBufferOffset in class OutputStreamWithBufferjava.io.IOExceptionpublic int getBufferSize()
getBufferSize in class AbstractResponseStreampublic void setBufferSize(int size)
setBufferSize in class AbstractResponseStreampublic int getRemaining()
getRemaining in class AbstractResponseStreamprotected int getBufferLength()
protected boolean isDisableAutoFlush()
public void clearBuffer()
clearBuffer in class AbstractResponseStream
public void write(int ch)
throws java.io.IOException
write in interface ByteAppendablewrite in class AbstractResponseStreamjava.io.IOException
public void write(byte[] buffer,
int offset,
int length)
throws java.io.IOException
write in interface ByteAppendablewrite in class AbstractResponseStreamjava.io.IOException
public void print(int ch)
throws java.io.IOException
print in class AbstractResponseStreamjava.io.IOException
public void print(char[] buffer,
int offset,
int length)
throws java.io.IOException
print in class AbstractResponseStreamjava.io.IOException
public char[] nextCharBuffer(int offset)
throws java.io.IOException
nextCharBuffer in class AbstractResponseStreamjava.io.IOExceptionprotected boolean isCharFlushing()
protected void flushCharBuffer()
throws java.io.IOException
java.io.IOExceptionpublic int getContentLength()
AbstractResponseStream
getContentLength in class AbstractResponseStream
public byte[] nextBuffer(int offset)
throws java.io.IOException
nextBuffer in class OutputStreamWithBufferjava.io.IOException
protected void flushByteBuffer()
throws java.io.IOException
java.io.IOException
protected void writeHeaders(int length)
throws java.io.IOException
length - the current buffer length
java.io.IOException
protected abstract void writeNext(byte[] buffer,
int offset,
int length,
boolean isEnd)
throws java.io.IOException
java.io.IOException
public void flushBuffer()
throws java.io.IOException
flushBuffer in class AbstractResponseStreamjava.io.IOException
public void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class AbstractResponseStreamjava.io.IOException
protected void closeImpl()
throws java.io.IOException
closeImpl in class AbstractResponseStreamjava.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||