All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.io.CharArrayWriter

java.lang.Object
   |
   +----java.io.Writer
           |
           +----java.io.CharArrayWriter

public class CharArrayWriter
extends Writer
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().


Variable Index

 o buf
The buffer where data is stored.
 o count
The number of chars in the buffer.

Constructor Index

 o CharArrayWriter()
Creates a new CharArrayWriter.
 o CharArrayWriter(int)
Creates a new CharArrayWriter with the specified initial size.

Method Index

 o close()
Close the stream.
 o flush()
Flush the stream.
 o reset()
Resets the buffer so that you can use it again without throwing away the already allocated buffer.
 o size()
Returns the current size of the buffer.
 o toCharArray()
Returns a copy of the input data.
 o toString()
Converts input data to a string.
 o write(char[], int, int)
Writes characters to the buffer.
 o write(int)
Writes a character to the buffer.
 o write(String, int, int)
Write a portion of a string to the buffer.
 o writeTo(Writer)
Writes the contents of the buffer to another character stream.

Variables

 o buf
Properties Inheritable 
   buf[]=char 
The buffer where data is stored.

 o count
Properties Inheritable 
   count=int 
The number of chars in the buffer.

Constructors

 o CharArrayWriter
    method CharArrayWriter() public 
Creates a new CharArrayWriter.

 o CharArrayWriter
    method CharArrayWriter(initialSize=int) public 
Creates a new CharArrayWriter with the specified initial size.

Methods

 o write
    method write(c=int)  public     
Writes a character to the buffer.

Overrides:
write in class Writer
 o write
    method write(c=char[], -
                 off=int, -
                 len=int)  public     
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
Overrides:
write in class Writer
 o write
    method write(str=String, -
                 off=int, -
                 len=int)  public     
Write a portion of a string to the buffer.

Parameters:
str - String to be written from
off - Offset from which to start reading characters
len - Number of characters to be written
Overrides:
write in class Writer
 o writeTo
    method writeTo(out=Writer)  public     Signals IOException
Writes the contents of the buffer to another character stream.

Parameters:
out - the output stream to write to
 o reset
    method reset()  public     
Resets the buffer so that you can use it again without throwing away the already allocated buffer.

 o toCharArray
    method toCharArray() returns char[] public     
Returns a copy of the input data.

 o size
    method size() returns int public     
Returns the current size of the buffer.

 o toString
    method toString() returns String public     
Converts input data to a string.

Returns:
the string.
Overrides:
toString in class Object
 o flush
    method flush()  public     
Flush the stream.

Overrides:
flush in class Writer
 o close
    method close()  public     
Close the stream. This method does not release the buffer, since its contents might still be required.

Overrides:
close in class Writer

All Packages  Class Hierarchy  This Package  Previous  Next  Index