public class MemoryStringWriter extends Writer
Constructor and Description |
---|
MemoryStringWriter()
Create a new character-stream writer whose critical sections will synchronize on the writer itself.
|
MemoryStringWriter(int bufferSize)
Create a new character-stream writer whose critical sections will synchronize on the writer itself.
|
MemoryStringWriter(int bufferSize,
int maximumBufferIncrement)
Create a new character-stream writer whose critical sections will synchronize on the writer itself.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stream, flushing it first.
|
MemoryStringReader |
createReader() |
void |
flush()
Flush the stream.
|
int |
getLength() |
char[] |
getRaw() |
char[] |
toByteArray() |
String |
toString() |
void |
write(char[] cbuf)
Writes
b.length bytes from the specified byte array to this output stream. |
void |
write(char[] cbuf,
int off,
int len)
Writes a portion of an array of characters.
|
public MemoryStringWriter()
public MemoryStringWriter(int bufferSize)
public MemoryStringWriter(int bufferSize, int maximumBufferIncrement)
public void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
cbuf
- Array of charactersoff
- Offset from which to start writing characterslen
- Number of characters to writeIOException
- If an I/O error occurspublic void write(char[] cbuf) throws IOException
b.length
bytes from the specified byte array to this output stream. The general contract for
write(b)
is that it should have exactly the same effect as the call write(b, 0,
b.length)
.write
in class Writer
cbuf
- the data.IOException
- if an I/O error occurs.OutputStream.write(byte[], int, int)
public void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
- If an I/O error occurspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Writer
IOException
- If an I/O error occurspublic char[] toByteArray()
public int getLength()
public char[] getRaw()
public MemoryStringReader createReader()