com.caucho.server.http
Class WrapperResponseStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.caucho.vfs.OutputStreamWithBuffer
          extended by com.caucho.server.http.AbstractResponseStream
              extended by com.caucho.server.http.WrapperResponseStream
All Implemented Interfaces:
ByteAppendable, java.io.Closeable, java.io.Flushable

public class WrapperResponseStream
extends AbstractResponseStream


Constructor Summary
WrapperResponseStream()
           
 
Method Summary
 void clearBuffer()
          Clears the buffer.
protected  void closeImpl()
          Close.
 void finish()
          Finish.
 void flush()
          Flushes the output.
 void flushBuffer()
          Flushes the buffer.
 void flushByte()
          Flushes the buffer.
 void flushChar()
          Flushes the buffer.
 void flushCharBuffer()
          Writes the char buffer to the output stream.
 byte[] getBuffer()
          Gets the byte buffer
 int getBufferOffset()
          Returns the buffer offset.
 int getBufferSize()
          Gets the buffer size.
 char[] getCharBuffer()
          Returns the char buffer.
 int getCharOffset()
          Returns the char buffer offset.
 int getRemaining()
          Returns the remaining buffer entries.
 void init(HttpServletResponse next)
           
 boolean isCauchoResponseStream()
          Returns true for a caucho response stream.
 byte[] nextBuffer(int offset)
          Returns the next buffer.
 char[] nextCharBuffer(int offset)
          Returns the next char buffer.
 void print(char[] buffer, int offset, int length)
          Writes the next chunk of data to the response stream.
 void print(int ch)
          Writes the next chunk of data to the response stream.
 void setBufferOffset(int offset)
          Sets the byte buffer offset.
 void setBufferSize(int size)
          Sets the buffer size.
 void setCharOffset(int offset)
          Sets the char buffer offset.
 void write(byte[] buf, int offset, int length)
          Writes the next chunk of data to the response stream.
 void write(int ch)
          Writes the next chunk of data to the response stream.
 
Methods inherited from class com.caucho.server.http.AbstractResponseStream
clear, close, completeCache, flushNext, getByteCacheStream, getCharCacheStream, getContentLength, getEncoding, isAutoFlush, isCloseComplete, isClosed, isClosing, isCommitted, isHead, killCaching, sendFile, setAutoFlush, setByteCacheStream, setCauchoResponse, setCharCacheStream, setCommitted, setEncoding, setHead, setLocale, setOutputStreamOnly, start, 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
 

Constructor Detail

WrapperResponseStream

public WrapperResponseStream()
Method Detail

init

public void init(HttpServletResponse next)

isCauchoResponseStream

public boolean isCauchoResponseStream()
Returns true for a caucho response stream.

Specified by:
isCauchoResponseStream in class AbstractResponseStream

setBufferSize

public void setBufferSize(int size)
Sets the buffer size.

Specified by:
setBufferSize in class AbstractResponseStream

getBufferSize

public int getBufferSize()
Gets the buffer size.

Specified by:
getBufferSize in class AbstractResponseStream

getRemaining

public int getRemaining()
Returns the remaining buffer entries.

Specified by:
getRemaining in class AbstractResponseStream

getCharBuffer

public char[] getCharBuffer()
Returns the char buffer.

Specified by:
getCharBuffer in class AbstractResponseStream

getCharOffset

public int getCharOffset()
Returns the char buffer offset.

Specified by:
getCharOffset in class AbstractResponseStream

setCharOffset

public void setCharOffset(int offset)
Sets the char buffer offset.

Specified by:
setCharOffset in class AbstractResponseStream

nextCharBuffer

public char[] nextCharBuffer(int offset)
                      throws java.io.IOException
Returns the next char buffer.

Specified by:
nextCharBuffer in class AbstractResponseStream
Throws:
java.io.IOException

print

public void print(int ch)
           throws java.io.IOException
Writes the next chunk of data to the response stream.

Specified by:
print in class AbstractResponseStream
Parameters:
buf - the buffer containing the data
offset - start offset into the buffer
length - length of the data in the buffer
Throws:
java.io.IOException

print

public void print(char[] buffer,
                  int offset,
                  int length)
           throws java.io.IOException
Writes the next chunk of data to the response stream.

Specified by:
print in class AbstractResponseStream
Parameters:
buf - the buffer containing the data
offset - start offset into the buffer
length - length of the data in the buffer
Throws:
java.io.IOException

getBufferOffset

public int getBufferOffset()
Returns the buffer offset.

Specified by:
getBufferOffset in class OutputStreamWithBuffer

setBufferOffset

public void setBufferOffset(int offset)
Sets the byte buffer offset.

Specified by:
setBufferOffset in class OutputStreamWithBuffer

getBuffer

public byte[] getBuffer()
Gets the byte buffer

Specified by:
getBuffer in class OutputStreamWithBuffer

nextBuffer

public byte[] nextBuffer(int offset)
                  throws java.io.IOException
Returns the next buffer.

Specified by:
nextBuffer in class OutputStreamWithBuffer
Returns:
the next buffer
Throws:
java.io.IOException

write

public void write(int ch)
           throws java.io.IOException
Writes the next chunk of data to the response stream.

Specified by:
write in interface ByteAppendable
Specified by:
write in class AbstractResponseStream
Parameters:
buf - the buffer containing the data
offset - start offset into the buffer
length - length of the data in the buffer
Throws:
java.io.IOException

write

public void write(byte[] buf,
                  int offset,
                  int length)
           throws java.io.IOException
Writes the next chunk of data to the response stream.

Specified by:
write in interface ByteAppendable
Specified by:
write in class AbstractResponseStream
Parameters:
buf - the buffer containing the data
offset - start offset into the buffer
length - length of the data in the buffer
Throws:
java.io.IOException

flushCharBuffer

public void flushCharBuffer()
                     throws java.io.IOException
Writes the char buffer to the output stream.

Throws:
java.io.IOException

flushBuffer

public void flushBuffer()
                 throws java.io.IOException
Flushes the buffer.

Specified by:
flushBuffer in class AbstractResponseStream
Throws:
java.io.IOException

flushChar

public void flushChar()
               throws java.io.IOException
Flushes the buffer.

Overrides:
flushChar in class AbstractResponseStream
Throws:
java.io.IOException

flushByte

public void flushByte()
               throws java.io.IOException
Flushes the buffer.

Overrides:
flushByte in class AbstractResponseStream
Throws:
java.io.IOException

clearBuffer

public void clearBuffer()
Clears the buffer.

Specified by:
clearBuffer in class AbstractResponseStream

flush

public void flush()
           throws java.io.IOException
Flushes the output.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class AbstractResponseStream
Throws:
java.io.IOException

finish

public void finish()
            throws java.io.IOException
Finish.

Throws:
java.io.IOException

closeImpl

protected void closeImpl()
                  throws java.io.IOException
Close.

Overrides:
closeImpl in class AbstractResponseStream
Throws:
java.io.IOException