|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
org.webmacro.util.QueueWriter
This writer buffers characters into a char array. Also, if you pass it a char array, it queues it into a queue of char array. The goal is to handle string processing with as little copying as possible. You can reset it and re-use the same local buffer to avoid a malloc as well.
UNSYNCHRONIZED: It is not safe to use this writer from multiple threads. It is an unsynchronized writer. It is intended for use in WebMacro, where only one thread exists within a single request, and is also the only thread with access to mutable data.
Field Summary |
Fields inherited from class java.io.Writer |
lock |
Constructor Summary | |
QueueWriter()
Create a new Writer |
|
QueueWriter(int defaultSize)
Create a new buffer. |
Method Summary | |
void |
close()
Does nothing |
void |
flush()
Does nothing |
static void |
main(java.lang.String[] arg)
|
void |
reset()
Reset the buffer so it can be used again |
int |
size()
Return the total number of characters stored in the buffer |
java.lang.String |
toString()
|
void |
write(char[] c,
int off,
int len)
Write the c[] array to the local buffer for later writing out. |
void |
write(int c)
Write a character to the buffer |
void |
write(java.lang.String str,
int off,
int len)
|
void |
writeTo(java.io.Writer out)
|
Methods inherited from class java.io.Writer |
write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public QueueWriter()
public QueueWriter(int defaultSize)
Method Detail |
public void write(char[] c, int off, int len)
public void write(int c)
public void write(java.lang.String str, int off, int len)
public java.lang.String toString()
public void writeTo(java.io.Writer out) throws java.io.IOException
java.io.IOException
public int size()
public void reset()
public void flush()
public void close()
public static void main(java.lang.String[] arg) throws java.lang.Exception
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |