java::io::CharArrayWriter Class Reference

Inheritance diagram for java::io::CharArrayWriter:

Inheritance graph
java::lang::Objectjava::lang::Interfacejava::io::Writer
[legend]
Collaboration diagram for java::io::CharArrayWriter:

Collaboration graph
java::lang::Objectjava::lang::Interfacejava::lang::ObjectRefjava::io::Writerjava::lang::Comparable
[legend]

List of all members.


Detailed Description

This class implements a character buffer that can be used as an Writer.

The buffer automatically grows when data is written to the stream. The data can be retrieved using toCharArray() and toString().

Author:
Herb Jellinek
Version:
1.16, 12/03/01
Since:
JDK1.1

Public Member Functions

 CharArrayWriter (jint initialSize=32)
 Creates a new CharArrayWriter with the specified initial size.
virtual void write (jint b)
 Writes a character to the buffer.
virtual void write (const Array< jchar > &b, jint off=0, jint len=-1)
 Writes characters to the buffer.
virtual void write (const String &str, jint off=0, jint len=-1)
 Write a portion of a string.
virtual void writeTo (Writer &out) const
 Writes the contents of the buffer to another character stream.
virtual void reset ()
 Resets the buffer so that you can use it again without throwing away the already allocated buffer.
virtual Array< jchartoCharArray () const
 Returns a copy of the input data.
virtual jint size () const
 Returns the current size of the buffer.
virtual String toString () const
 Converts input data to a string.

Constructor & Destructor Documentation

java::io::CharArrayWriter::CharArrayWriter ( jint  initialSize = 32  ) 

Creates a new CharArrayWriter with the specified initial size.

Parameters:
initialSize an int specifying the initial buffer size.
Exceptions:
IllegalArgumentException if initialSize is negative


Member Function Documentation

virtual void java::io::CharArrayWriter::write ( jint  b  )  [virtual]

Writes a character to the buffer.

Implements java::io::Writer.

virtual void java::io::CharArrayWriter::write ( const Array< jchar > &  b,
jint  off = 0,
jint  len = -1 
) [virtual]

Writes characters to the buffer.

Parameters:
c the data to be written
off the start offset in the data
len the number of chars that are written

Implements java::io::Writer.

virtual void java::io::CharArrayWriter::write ( const String str,
jint  off = 0,
jint  len = -1 
) [virtual]

Write a portion of a string.

Parameters:
str A String
off Offset from which to start writing characters
len Number of characters to write
Exceptions:
IOException If an I/O error occurs

Implements java::io::Writer.

virtual void java::io::CharArrayWriter::writeTo ( Writer out  )  const [virtual]

Writes the contents of the buffer to another character stream.

Parameters:
out the output stream to write to
Exceptions:
IOException If an I/O error occurs.

virtual void java::io::CharArrayWriter::reset (  )  [virtual]

Resets the buffer so that you can use it again without throwing away the already allocated buffer.

virtual Array<jchar> java::io::CharArrayWriter::toCharArray (  )  const [virtual]

Returns a copy of the input data.

No thread protection for efficiency. Use with care.

Returns:
an array of chars copied from the input data.

virtual jint java::io::CharArrayWriter::size (  )  const [virtual]

Returns the current size of the buffer.

Returns:
an int representing the current size of the buffer.

virtual String java::io::CharArrayWriter::toString (  )  const [virtual]

Converts input data to a string.

Returns:
the string.

Reimplemented from java::lang::Object.


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:27 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3