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().
 
 
 buf buf
- The buffer where data is stored. 
 count count
- The number of chars in the buffer. 
 
 
 CharArrayWriter() CharArrayWriter()
- Creates a new CharArrayWriter. 
 CharArrayWriter(int) CharArrayWriter(int)
- Creates a new CharArrayWriter with the specified initial size. 
 
 
 close() close()
- Close the stream. 
 flush() flush()
- Flush the stream. 
 reset() reset()
- Resets the buffer so that you can use it again without throwing away the already allocated buffer. 
 size() size()
- Returns the current size of the buffer. 
 toCharArray() toCharArray()
- Returns a copy of the input data. 
 toString() toString()
- Converts input data to a string. 
 write(char[], int, int) write(char[], int, int)
- Writes characters to the buffer. 
 write(int) write(int)
- Writes a character to the buffer. 
 write(String, int, int) write(String, int, int)
- Write a portion of a string to the buffer. 
 writeTo(Writer) writeTo(Writer)
- Writes the contents of the buffer to another character stream. 
 
 
 buf
 buf 
protected char buf[]
- The buffer where data is stored.
 count
 count 
protected int count
- The number of chars in the buffer.
 
 
 CharArrayWriter
 CharArrayWriter 
public CharArrayWriter()
- Creates a new CharArrayWriter. 
 CharArrayWriter
 CharArrayWriter 
public CharArrayWriter(int initialSize)
- Creates a new CharArrayWriter with the specified initial size. 
 
 
 write
 write 
public void write(int c)
- Writes a character to the buffer. - Overrides: 
- write in class Writer 
 
 write
 write 
public void write(char c[],
                   int off,
                   int len)
- 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 
 
 write
 write 
public void write(String str,
                   int off,
                   int len)
- 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 
 
 writeTo
 writeTo 
public void writeTo(Writer out) throws IOException
- Writes the contents of the buffer to another character stream. - Parameters: 
- out - the output stream to write to 
 
 reset
 reset 
public void reset()
- Resets the buffer so that you can use it again without throwing away the already allocated buffer. 
 toCharArray
 toCharArray 
public char[] toCharArray()
- Returns a copy of the input data. 
 size
 size 
public int size()
- Returns the current size of the buffer. 
 toString
 toString 
public String toString()
- Converts input data to a string. - Returns: 
- the string. 
- Overrides: 
- toString in class Object 
 
 flush
 flush 
public void flush()
- Flush the stream. - Overrides: 
- flush in class Writer 
 
 close
 close 
public void close()
- 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
Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.