com.caucho.server.http
Class ToCharResponseStream

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

public abstract class ToCharResponseStream
extends AbstractResponseStream


Constructor Summary
ToCharResponseStream()
           
 
Method Summary
 void clearBuffer()
          Flushes the buffer.
 void flushBuffer()
          Flushes the buffer.
 void flushChar()
          Flushes the buffer.
 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 offset.
abstract  java.lang.String getEncoding()
          Returns the encoding.
 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)
          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 buffer offset.
 void setBufferSize(int size)
          Sets the buffer size.
 void setCharOffset(int offset)
          Sets the char offset.
 void start()
          Initializes the Buffered Response stream at the beginning of a request.
 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.
protected abstract  void writeNext(char[] buffer, int offset, int length)
          Writes to the next.
 
Methods inherited from class com.caucho.server.http.AbstractResponseStream
clear, close, closeImpl, completeCache, flush, flushByte, flushNext, getByteCacheStream, getCharCacheStream, getContentLength, isAutoFlush, isCloseComplete, isClosed, isClosing, isCommitted, isHead, killCaching, sendFile, setAutoFlush, setByteCacheStream, setCauchoResponse, setCharCacheStream, setCommitted, setEncoding, setHead, setLocale, setOutputStreamOnly, 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

ToCharResponseStream

public ToCharResponseStream()
Method Detail

start

public void start()
Initializes the Buffered Response stream at the beginning of a request.

Overrides:
start in class AbstractResponseStream

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 offset.

Specified by:
getCharOffset in class AbstractResponseStream

setCharOffset

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

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

nextCharBuffer

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

Specified by:
nextCharBuffer 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

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(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

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

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

clearBuffer

public void clearBuffer()
Flushes the buffer.

Specified by:
clearBuffer in class AbstractResponseStream

getEncoding

public abstract java.lang.String getEncoding()
Returns the encoding.

Overrides:
getEncoding in class AbstractResponseStream

writeNext

protected abstract void writeNext(char[] buffer,
                                  int offset,
                                  int length)
                           throws java.io.IOException
Writes to the next.

Throws:
java.io.IOException