public class FastStringWriter
extends java.io.PrintWriter
| Constructor and Description |
|---|
FastStringWriter()
Create a new string writer, using the default initial string-buffer
size.
|
FastStringWriter(int initialSize)
Create a new string writer, using the specified initial string-buffer
size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closing a StringWriter has no effect.
|
void |
flush()
Flush the stream.
|
FastStringBuffer |
getBuffer()
Return the string buffer itself.
|
void |
print(boolean b)
Print a boolean value.
|
void |
print(char c)
Print a character.
|
void |
print(char[] s)
Print an array of characters.
|
void |
print(double d)
Print a double-precision floating-point number.
|
void |
print(float f)
Print a floating-point number.
|
void |
print(int i)
Print an integer.
|
void |
print(long l)
Print a long integer.
|
void |
print(java.lang.Object obj)
Print an object.
|
void |
print(java.lang.String s)
Print a string.
|
void |
println()
Terminate the current line by writing the line separator string.
|
void |
println(boolean x)
Print a boolean value and then terminate the line.
|
void |
println(char x)
Print a character and then terminate the line.
|
void |
println(char[] x)
Print an array of characters and then terminate the line.
|
void |
println(double x)
Print a double-precision floating-point number and then terminate the
line.
|
void |
println(float x)
Print a floating-point number and then terminate the line.
|
void |
println(int x)
Print an integer and then terminate the line.
|
void |
println(long x)
Print a long integer and then terminate the line.
|
void |
println(java.lang.Object x)
Print an Object and then terminate the line.
|
void |
println(java.lang.String x)
Print a String and then terminate the line.
|
java.lang.String |
toString()
Return the buffer's current value as a string.
|
void |
write(char[] cbuf,
int off,
int len)
Write a portion of an array of characters.
|
void |
write(int c)
Write a single character.
|
void |
write(java.lang.String str)
Write a string.
|
void |
write(java.lang.String str,
int off,
int len)
Write a portion of a string.
|
public FastStringWriter()
public FastStringWriter(int initialSize)
initialSize - an int specifying the initial size of the buffer.public void write(int c)
write in class java.io.PrintWriterpublic void write(char[] cbuf,
int off,
int len)
write in class java.io.PrintWritercbuf - Array of charactersoff - Offset from which to start writing characterslen - Number of characters to writepublic void write(java.lang.String str)
write in class java.io.PrintWriterpublic void write(java.lang.String str,
int off,
int len)
write in class java.io.PrintWriterstr - String to be writtenoff - Offset from which to start writing characterslen - Number of characters to writepublic java.lang.String toString()
toString in class java.lang.Objectpublic FastStringBuffer getBuffer()
public void flush()
flush in interface java.io.Flushableflush in class java.io.PrintWriterpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.PrintWriterpublic void print(boolean b)
String.valueOf(boolean) is translated into bytes
according to the platform's default character encoding, and these bytes
are written in exactly the manner of the write(int) method.print in class java.io.PrintWriterb - The boolean to be printedpublic void print(char c)
write(int) method.print in class java.io.PrintWriterc - The char to be printedpublic void print(int i)
String.valueOf(int) is translated into bytes according
to the platform's default character encoding, and these bytes are
written in exactly the manner of the write(int)
method.print in class java.io.PrintWriteri - The int to be printedInteger.toString(int)public void print(long l)
String.valueOf(long) is translated into bytes
according to the platform's default character encoding, and these bytes
are written in exactly the manner of the write(int)
method.print in class java.io.PrintWriterl - The long to be printedLong.toString(long)public void print(float f)
String.valueOf(float) is translated into bytes
according to the platform's default character encoding, and these bytes
are written in exactly the manner of the write(int)
method.print in class java.io.PrintWriterf - The float to be printedFloat.toString(float)public void print(double d)
String.valueOf(double) is translated into
bytes according to the platform's default character encoding, and these
bytes are written in exactly the manner of the write(int) method.print in class java.io.PrintWriterd - The double to be printedDouble.toString(double)public void print(char[] s)
write(int)
method.print in class java.io.PrintWriters - The array of chars to be printedjava.lang.NullPointerException - If s is nullpublic void print(java.lang.String s)
null then the string
"null" is printed. Otherwise, the string's characters are
converted into bytes according to the platform's default character
encoding, and these bytes are written in exactly the manner of the
write(int) method.print in class java.io.PrintWriters - The String to be printedpublic void print(java.lang.Object obj)
String.valueOf(Object) method is translated into bytes
according to the platform's default character encoding, and these bytes
are written in exactly the manner of the write(int)
method.print in class java.io.PrintWriterobj - The Object to be printedObject.toString()public void println()
line.separator, and is not necessarily a single newline
character ('\n').println in class java.io.PrintWriterpublic void println(boolean x)
print(boolean) and then
println().println in class java.io.PrintWriterx - the boolean value to be printedpublic void println(char x)
print(char) and then println().println in class java.io.PrintWriterx - the char value to be printedpublic void println(int x)
print(int) and then println().println in class java.io.PrintWriterx - the int value to be printedpublic void println(long x)
print(long) and then
println().println in class java.io.PrintWriterx - the long value to be printedpublic void println(float x)
print(float) and then
println().println in class java.io.PrintWriterx - the float value to be printedpublic void println(double x)
print(double) and then println().println in class java.io.PrintWriterx - the double value to be printedpublic void println(char[] x)
print(char[]) and then
println().println in class java.io.PrintWriterx - the array of char values to be printedpublic void println(java.lang.String x)
print(String) and then
println().println in class java.io.PrintWriterx - the String value to be printedpublic void println(java.lang.Object x)
print(Object) and then
println().println in class java.io.PrintWriterx - the Object value to be printed