public class StringOutputStream
extends java.io.OutputStream
implements java.io.Serializable
OutputStream to an internal String. Internally converts bytes
to a Strings and stores them in an internal StringBuilder.| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
encoding |
protected java.lang.StringBuilder |
sb
The internal destination StringBuffer.
|
| Constructor and Description |
|---|
StringOutputStream()
Creates new StringOutputStream, makes a new internal StringBuffer.
|
StringOutputStream(java.lang.String encoding) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Sets the internal StringBuffer to null.
|
java.lang.String |
toString()
Returns the content of the internal StringBuffer as a String, the result
of all writing to this OutputStream.
|
void |
write(byte[] b)
Writes and appends byte array to StringOutputStream.
|
void |
write(byte[] b,
int off,
int len)
Writes and appends a byte array to StringOutputStream.
|
void |
write(int b)
Writes and appends a single byte to StringOutputStream.
|
protected final java.lang.StringBuilder sb
protected final java.lang.String encoding
public StringOutputStream()
public StringOutputStream(java.lang.String encoding)
public java.lang.String toString()
toString in class java.lang.Objectpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreampublic void write(byte[] b)
throws java.io.IOException
write in class java.io.OutputStreamb - byte arrayjava.io.IOExceptionpublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreamb - the byte arrayoff - the byte array starting indexlen - the number of bytes from byte array to write to the streamjava.io.IOExceptionpublic void write(int b)
write in class java.io.OutputStreamb - the byte as an int to addCopyright © 2003-2013 Jodd Team