public class FastStringWriter extends Writer
StringWriter
. This class
implements a character stream that collects its output in a fast,
unsynchronized string buffer, which can then be used to construct a string.
Instances of this class are not thread-safe.
Constructor and Description |
---|
FastStringWriter()
Deprecated.
Creates a new
FastStringWriter using a default initial
internal buffer size. |
FastStringWriter(int initialSize)
Deprecated.
Creates a new
FastStringWriter using a specified initial
string buffer size. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
Closes this writer.
|
void |
flush()
Deprecated.
Flushes this writer.
|
FastStringBuffer |
getBuffer()
Deprecated.
Returns the underlying string buffer itself.
|
String |
toString()
Deprecated.
Returns the current value of the underlying buffer as a string.
|
void |
write(char[] cbuf)
Deprecated.
Writes an array of characters.
|
void |
write(char[] cbuf,
int off,
int len)
Deprecated.
Writes a portion of an array of characters.
|
void |
write(int c)
Deprecated.
Writes a single character.
|
void |
write(String str)
Deprecated.
Writes a character string.
|
void |
write(String str,
int off,
int len)
Deprecated.
Writes a portion of a character string.
|
public FastStringWriter()
FastStringWriter
using a default initial
internal buffer size.public FastStringWriter(int initialSize) throws IllegalArgumentException
FastStringWriter
using a specified initial
string buffer size.initialSize
- the initial size of the buffer, must be >= 0.IllegalArgumentException
- if initialSize < 0
.public void write(int c) throws IOException
write
in class Writer
c
- the character to write.IOException
- if this writer has been closed (see close()
).public void write(char[] cbuf) throws IOException, IllegalArgumentException
write
in class Writer
cbuf
- the array of characters to write, cannot be null
.IOException
- if this writer has been closed (see close()
).IllegalArgumentException
- if cbuf == null
.public void write(char[] cbuf, int off, int len) throws IllegalArgumentException, IOException, IndexOutOfBoundsException
write
in class Writer
cbuf
- the array of characters to write a portion of, cannot be
null
.off
- offset from which to start writing characters, must be >= 0 and
< sbuf.length
.len
- the number of characters to write.IOException
- if this writer has been closed (see close()
).IllegalArgumentException
- if cbuf == null
.IndexOutOfBoundsException
- if the offset and/or the length is invalid.public void write(String str) throws IOException, IllegalArgumentException
write
in class Writer
str
- the character string to write, cannot be null
.IOException
- if this writer has been closed (see close()
).IllegalArgumentException
- if str == null
.public void write(String str, int off, int len) throws IllegalArgumentException, IOException, IndexOutOfBoundsException
write
in class Writer
str
- the character string to write a portion of, cannot be
null
.off
- offset from which to start writing characters, must be >= 0 and
< str.length()
.len
- the number of characters to write.IOException
- if this writer has been closed (see close()
).IllegalArgumentException
- if str == null
.IndexOutOfBoundsException
- if the offset and/or the length is invalid.public void flush() throws IOException
The implementation of this method does not nothing except checking that this writer is not yet closed.
public void close()
IOException
if called.
Calling this method on a FastStringWriter
after use is
really optional.
public String toString()
public FastStringBuffer getBuffer()
null
.See http://www.xins.org/.