public class StringBuilderOutputStream extends OutputStream
| Constructor and Description |
|---|
StringBuilderOutputStream()
Create a new string writer using the default initial string-buffer
size.
|
StringBuilderOutputStream(int initialSize)
Create a new string writer using the specified initial string-buffer
size.
|
StringBuilderOutputStream(StringBuilder sb)
Create a new string writer using a passed in StringBuilder
size.
|
| Modifier and Type | Method and Description |
|---|---|
StringBuilderOutputStream |
append(byte c)
Appends the specified character to this writer.
|
StringBuilderOutputStream |
append(CharSequence csq) |
StringBuilderOutputStream |
append(CharSequence csq,
int start,
int end) |
void |
close() |
void |
flush() |
StringBuilder |
getBuffer()
Return the string buffer itself.
|
void |
reset() |
String |
toString()
Return the buffer's current value as a string.
|
void |
write(byte[] b) |
void |
write(byte[] bbuf,
int off,
int len)
Write a portion of an array of characters.
|
void |
write(int c)
Write a single character.
|
void |
write(String str)
Write a string.
|
void |
write(String str,
int off,
int len)
Write a portion of a string.
|
public StringBuilderOutputStream()
public StringBuilderOutputStream(StringBuilder sb)
public StringBuilderOutputStream(int initialSize)
initialSize - The number of byte values that will fit into this buffer
before it is automatically expandedIllegalArgumentException - If initialSize is negativepublic void write(int c)
write in class OutputStreampublic void write(byte[] bbuf,
int off,
int len)
write in class OutputStreambbuf - Array of charactersoff - Offset from which to start writing characterslen - Number of characters to writepublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(String str)
public void write(String str, int off, int len)
str - String to be writtenoff - Offset from which to start writing characterslen - Number of characters to writepublic StringBuilderOutputStream append(CharSequence csq)
public StringBuilderOutputStream append(CharSequence csq, int start, int end)
public StringBuilderOutputStream append(byte c)
An invocation of this method of the form out.append(c) behaves in exactly the same way as the invocation
out.write(c) c - The 16-bit character to appendpublic String toString()
public StringBuilder getBuffer()
public void reset()
public void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionCopyright © 2017. All rights reserved.