The buffer used by Tomcat response. This is a derivative of the Tomcat 3.3
OutputBuffer, with the removal of some of the state handling (which in
Coyote is mostly the Processor's responsability).
BYTE_STATE
public final int BYTE_STATE
CHAR_STATE
public final int CHAR_STATE
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
- 8192
DEFAULT_ENCODING
public static final String DEFAULT_ENCODING
INITIAL_STATE
public final int INITIAL_STATE
conv
protected C2BConverter conv
Current char to byte converter.
encoders
protected HashMap encoders
List of encoders.
checkConverter
public void checkConverter()
throws IOException
close
public void close()
throws IOException
Close the output buffer. This tries to calculate the response size if
the response has not been committed yet.
doFlush
protected void doFlush(boolean realFlush)
throws IOException
Flush bytes or chars contained in the buffer.
flush
public void flush()
throws IOException
Flush bytes or chars contained in the buffer.
flushBytes
public void flushBytes()
throws IOException
Real write - this buffer will be sent to the client
flushChars
public void flushChars()
throws IOException
flushCharsNeeded
public boolean flushCharsNeeded()
getBufferSize
public int getBufferSize()
getBytesWritten
public int getBytesWritten()
getCharsWritten
public int getCharsWritten()
getContentWritten
public int getContentWritten()
getResponse
public Response getResponse()
Get associated Coyote response.
- the associated Coyote response
isNew
public boolean isNew()
True if this buffer hasn't been used ( since recycle() ) -
i.e. no chars or bytes have been added to the buffer.
isSuspended
public boolean isSuspended()
Is the response output suspended ?
- suspended flag value
log
protected void log(String s)
realWriteBytes
public void realWriteBytes(buf[] ,
int off,
int cnt)
throws IOException
Sends the buffer data to the client output, checking the
state of Response and calling the right interceptors.
off
- Offsetcnt
- Length
realWriteChars
public void realWriteChars(c[] ,
int off,
int len)
throws IOException
recycle
public void recycle()
Recycle the output buffer.
setBufferSize
public void setBufferSize(int size)
setConverter
protected void setConverter()
throws IOException
setEncoding
public void setEncoding(String s)
setResponse
public void setResponse(Response coyoteResponse)
Associated Coyote response.
coyoteResponse
- Associated Coyote response
setSuspended
public void setSuspended(boolean suspended)
Set the suspended flag.
suspended
- New suspended flag value
write
public void write(String s)
throws IOException
write
public void write(String s,
int off,
int len)
throws IOException
Append a string to the buffer
write
public void write(StringBuffer sb)
throws IOException
write
public void write(b[] ,
int off,
int len)
throws IOException
write
public void write(c[] )
throws IOException
write
public void write(c[] ,
int off,
int len)
throws IOException
write
public void write(int c)
throws IOException
writeByte
public void writeByte(int b)
throws IOException