jodd.io
Class FastCharArrayWriter

java.lang.Object
  extended by java.io.Writer
      extended by jodd.io.FastCharArrayWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class FastCharArrayWriter
extends java.io.Writer

Similar as FastByteArrayOutputStream but for Writer.


Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
FastCharArrayWriter()
          Creates a new writer.
FastCharArrayWriter(int size)
          Creates a new char array writer, with a buffer capacity of the specified size, in bytes.
 
Method Summary
 void close()
          Closing a FastCharArrayWriter has no effect.
 void flush()
          Flushing a FastCharArrayWriter has no effects.
 void reset()
           
 int size()
           
 char[] toCharArray()
           
 java.lang.String toString()
           
 void write(char[] b, int off, int len)
           
 void write(int b)
          Calls the write(char[]) method.
 void write(java.lang.String s, int off, int len)
           
 void writeTo(java.io.Writer out)
           
 
Methods inherited from class java.io.Writer
append, append, append, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FastCharArrayWriter

public FastCharArrayWriter()
Creates a new writer. The buffer capacity is initially 1024 bytes, though its size increases if necessary.


FastCharArrayWriter

public FastCharArrayWriter(int size)
Creates a new char array writer, with a buffer capacity of the specified size, in bytes.

Parameters:
size - the initial size.
Throws:
java.lang.IllegalArgumentException - if size is negative.
Method Detail

write

public void write(char[] b,
                  int off,
                  int len)
Specified by:
write in class java.io.Writer
See Also:
Writer.write(char[], int, int)

write

public void write(int b)
Calls the write(char[]) method.

Overrides:
write in class java.io.Writer
See Also:
Writer.write(int)

write

public void write(java.lang.String s,
                  int off,
                  int len)
Overrides:
write in class java.io.Writer

size

public int size()
See Also:
CharArrayWriter.size()

close

public void close()
Closing a FastCharArrayWriter has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.

Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer

flush

public void flush()
Flushing a FastCharArrayWriter has no effects.

Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer

reset

public void reset()
See Also:
CharArrayWriter.reset()

writeTo

public void writeTo(java.io.Writer out)
             throws java.io.IOException
Throws:
java.io.IOException
See Also:
CharArrayWriter.writeTo(java.io.Writer)

toCharArray

public char[] toCharArray()
See Also:
CharArrayWriter.toCharArray()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
CharArrayWriter.toString()


Copyright ©2008 Jodd Team