|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Writer org.apache.velocity.io.VelocityWriter
public final class VelocityWriter
Implementation of a fast Writer. It was originally taken from JspWriter and modified to have less syncronization going on.
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER
constant indicating that the Writer is buffered and is using the implementation default buffer size |
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 |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
VelocityWriter(Writer writer)
Create a buffered character-output stream that uses a default-sized output buffer. |
|
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 |
clear()
Discard the output buffer. |
void |
close()
Close the stream. |
void |
flush()
Flush the stream. |
int |
getBufferSize()
This method returns the size of the buffer used by the JspWriter. |
int |
getRemaining()
|
boolean |
isAutoFlush()
This method indicates whether the JspWriter is autoFlushing. |
void |
recycle(Writer writer)
resets this class so that it can be reused |
void |
write(char[] buf)
Write an array of characters. |
void |
write(char[] cbuf,
int off,
int len)
Write a portion of an array of characters. |
void |
write(int c)
Write a single character. |
void |
write(String s)
Write a string. |
void |
write(String s,
int off,
int len)
Write a portion of a String. |
Methods inherited from class java.io.Writer |
---|
append, append, append |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NO_BUFFER
public static final int DEFAULT_BUFFER
public static final int UNBOUNDED_BUFFER
Constructor Detail |
---|
public VelocityWriter(Writer writer)
writer
- Writer to wrap aroundpublic VelocityWriter(Writer writer, int sz, boolean autoFlush)
writer
- Writer to wrap aroundsz
- Output-buffer size, a positive integerautoFlush
-
IllegalArgumentException
- If sz is <= 0Method Detail |
---|
public int getBufferSize()
public boolean isAutoFlush()
public final void clear()
public final void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
public final void close() throws IOException
close
in interface Closeable
close
in class Writer
IOException
public final int getRemaining()
public final void write(int c) throws IOException
write
in class Writer
c
-
IOException
public final void write(char[] cbuf, int off, int len) throws IOException
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.
write
in class Writer
cbuf
- A character arrayoff
- Offset from which to start reading characterslen
- Number of characters to write
IOException
public final void write(char[] buf) throws IOException
write
in class Writer
buf
-
IOException
public final void write(String s, int off, int len) throws IOException
write
in class Writer
s
- String to be writtenoff
- Offset from which to start reading characterslen
- Number of characters to be written
IOException
public final void write(String s) throws IOException
write
in class Writer
s
-
IOException
public final void recycle(Writer writer)
writer
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |