com.caucho.server.http
Class StubResponseStream

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.StubResponseStream
All Implemented Interfaces:
ByteAppendable, java.io.Closeable, java.io.Flushable

public class StubResponseStream
extends AbstractResponseStream

API for handling the PrintWriter/ServletOutputStream


Constructor Summary
StubResponseStream()
           
 
Method Summary
 void clearBuffer()
          Clears the output buffer.
 void flushBuffer()
          Flushes the output buffer.
 byte[] getBuffer()
          Returns the stream's buffer.
 int getBufferOffset()
          Returns the stream's 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.
 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 a char array to the output.
 void print(int ch)
          Writes a character to the output.
 void setBufferOffset(int offset)
          Sets the stream's buffer length.
 void setBufferSize(int size)
          Sets the buffer size.
 void setCharOffset(int offset)
          Sets the char buffer offset.
 void write(byte[] buffer, int offset, int length)
          Writes a byte array to the output.
 void write(int v)
          Writes a byte to the output.
 
Methods inherited from class com.caucho.server.http.AbstractResponseStream
clear, close, closeImpl, completeCache, flush, flushByte, flushChar, 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

StubResponseStream

public StubResponseStream()
Method Detail

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

getBuffer

public byte[] getBuffer()
                 throws java.io.IOException
Returns the stream's buffer.

Specified by:
getBuffer in class OutputStreamWithBuffer
Throws:
java.io.IOException

getBufferOffset

public int getBufferOffset()
                    throws java.io.IOException
Returns the stream's buffer offset.

Specified by:
getBufferOffset in class OutputStreamWithBuffer
Throws:
java.io.IOException

setBufferOffset

public void setBufferOffset(int offset)
                     throws java.io.IOException
Sets the stream's buffer length.

Specified by:
setBufferOffset in class OutputStreamWithBuffer
Throws:
java.io.IOException

nextBuffer

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

Specified by:
nextBuffer in class OutputStreamWithBuffer
Parameters:
length - the length of the completed buffer
Returns:
the next buffer
Throws:
java.io.IOException

getCharBuffer

public char[] getCharBuffer()
                     throws java.io.IOException
Returns the char buffer.

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

getCharOffset

public int getCharOffset()
                  throws java.io.IOException
Returns the char buffer offset.

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

setCharOffset

public void setCharOffset(int offset)
                   throws java.io.IOException
Sets the char buffer offset.

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

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

write

public void write(int v)
           throws java.io.IOException
Writes a byte to the output.

Specified by:
write in interface ByteAppendable
Specified by:
write in class AbstractResponseStream
Throws:
java.io.IOException

write

public void write(byte[] buffer,
                  int offset,
                  int length)
           throws java.io.IOException
Writes a byte array to the output.

Specified by:
write in interface ByteAppendable
Specified by:
write in class AbstractResponseStream
Throws:
java.io.IOException

print

public void print(int ch)
           throws java.io.IOException
Writes a character to the output.

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

print

public void print(char[] buffer,
                  int offset,
                  int length)
           throws java.io.IOException
Writes a char array to the output.

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

clearBuffer

public void clearBuffer()
Clears the output buffer.

Specified by:
clearBuffer in class AbstractResponseStream

flushBuffer

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

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