@OpenApiAll
public class MemoryWriter
extends java.io.Writer
Constructor and Description |
---|
MemoryWriter()
Create a new memory writer using the default initial string-buffer size.
|
MemoryWriter(int initialSize)
Create a new memory writer using the specified initial string-buffer size.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stream.
|
void |
flush()
Flush the stream.
|
java.lang.StringBuffer |
getBuffer()
Return the string buffer itself.
|
long |
size()
Return the size of current written data.
|
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 MemoryWriter()
public MemoryWriter(int initialSize)
initialSize
- The number of char
values that will fit into this buffer before it is
automatically expandedjava.lang.IllegalArgumentException
- If initialSize
is negativepublic void write(int c) throws java.io.IOException
write
in class java.io.Writer
c
- characterjava.io.IOException
- If an I/O error occurspublic void write(char[] cbuf, int off, int len) throws java.io.IOException
write
in class java.io.Writer
cbuf
- Array of charactersoff
- Offset from which to start writing characterslen
- Number of characters to writejava.io.IOException
- If an I/O error occurspublic void write(java.lang.String str)
write
in class java.io.Writer
str
- string to writepublic void write(java.lang.String str, int off, int len)
write
in class java.io.Writer
str
- 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.Object
public void flush()
flush
in interface java.io.Flushable
flush
in class java.io.Writer
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
- If an I/O error occurspublic java.lang.StringBuffer getBuffer() throws java.io.IOException
java.io.IOException
- the stream has been closedpublic long size()
Copyright © 2010 - No Magic Asia