GeezerVison is showing docs.oracle.com — CharArrayWriter (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.io
Class CharArrayWriter
-
-
Field Summary
Fields
| Modifier and Type |
Field |
Description |
protected char[] |
buf |
The buffer where data is stored.
|
protected int |
count |
The number of chars in the buffer.
|
-
Constructor Summary
Constructors
| Constructor |
Description |
CharArrayWriter() |
Creates a new CharArrayWriter.
|
CharArrayWriter(int initialSize) |
Creates a new CharArrayWriter with the specified initial size.
|
-
Method Summary
All Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
CharArrayWriter |
append(char c) |
Appends the specified character to this writer.
|
CharArrayWriter |
append(CharSequence csq) |
Appends the specified character sequence to this writer.
|
CharArrayWriter |
append(CharSequence csq,
int start,
int end) |
Appends a subsequence of the specified character sequence to this writer.
|
void |
close() |
Close the stream.
|
void |
flush() |
Flush the stream.
|
void |
reset() |
Resets the buffer so that you can use it again without
throwing away the already allocated buffer.
|
int |
size() |
Returns the current size of the buffer.
|
char[] |
toCharArray() |
Returns a copy of the input data.
|
String |
toString() |
Converts input data to a string.
|
void |
write(char[] c,
int off,
int len) |
Writes characters to the buffer.
|
void |
write(int c) |
Writes a character to the buffer.
|
void |
write(String str,
int off,
int len) |
Write a portion of a string to the buffer.
|
void |
writeTo(Writer out) |
Writes the contents of the buffer to another character stream.
|
-
-
Method Detail
-
write
public void write(char[] c,
int off,
int len)
Writes characters to the buffer.
- Specified by:
write in class Writer
- Parameters:
c - the data to be written
off - the start offset in the data
len - the number of chars that are written
-
write
public void write(String str,
int off,
int len)
Write a portion of a string to the buffer.
- Overrides:
write in class Writer
- Parameters:
str - String to be written from
off - Offset from which to start reading characters
len - Number of characters to be written
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|