org.apache.velocity.io
public final class VelocityWriter extends Writer
Version: $Id: VelocityWriter.java,v 1.8.4.1 2004/03/03 23:22:54 geirm Exp $
Field Summary | |
---|---|
protected boolean | autoFlush |
protected int | bufferSize |
char[] | cb |
static int | defaultCharBufferSize |
static int | DEFAULT_BUFFER
constant indicating that the Writer is buffered and is using the
implementation default buffer size |
boolean | flushed |
int | nextChar |
static int | NO_BUFFER
constant indicating that the Writer is not buffering output |
static int | UNBOUNDED_BUFFER
constant indicating that the Writer is buffered and is unbounded;
this is used in BodyContent |
Writer | writer |
Constructor Summary | |
---|---|
VelocityWriter(Writer writer)
Create a buffered character-output stream that uses a default-sized
output buffer.
| |
VelocityWriter(int bufferSize, boolean autoFlush)
private constructor. | |
VelocityWriter(Writer writer, int sz, boolean autoFlush)
Create a new buffered character-output stream that uses an output
buffer of the given size.
|
Method Summary | |
---|---|
void | bufferOverflow() |
void | clear()
Discard the output buffer. |
void | close()
Close the stream.
|
void | flush()
Flush the stream.
|
void | flushBuffer()
Flush the output buffer to the underlying character stream, without
flushing the stream itself. |
int | getBufferSize()
This method returns the size of the buffer used by the JspWriter.
|
int | getRemaining() |
void | init(Writer writer, int sz, boolean autoFlush) |
boolean | isAutoFlush()
This method indicates whether the JspWriter is autoFlushing.
|
int | min(int a, int b)
Our own little min method, to avoid loading
java.lang.Math if we've run out of file
descriptors and we're trying to print a stack trace. |
void | recycle(Writer writer)
resets this class so that it can be reused
|
void | write(int c)
Write a single character.
|
void | write(char[] cbuf, int off, int len)
Write a portion of an array of characters.
|
void | write(char[] buf)
Write an array of characters. |
void | write(String s, int off, int len)
Write a portion of a String.
|
void | write(String s)
Write a string. |
Parameters: response A Servlet Response
Parameters: response A Servlet Response sz Output-buffer size, a positive integer
Throws: IllegalArgumentException If sz is <= 0
Returns: the size of the buffer in bytes, or 0 is unbuffered.
Returns: the number of bytes unused in the buffer
Returns: if this JspWriter is auto flushing or throwing IOExceptions on buffer overflow conditions
java.lang.Math
if we've run out of file
descriptors and we're trying to print a stack trace. Ordinarily this method stores characters from the given array into
this stream's buffer, flushing the buffer to the underlying stream as
needed. If the requested length is at least as large as the buffer,
however, then this method will flush the buffer and write the characters
directly to the underlying stream. Thus redundant
DiscardableBufferedWriter
s will not copy data unnecessarily.
Parameters: cbuf A character array off Offset from which to start reading characters len Number of characters to write
Parameters: s String to be written off Offset from which to start reading characters len Number of characters to be written