public class FastStringWriter extends Writer
This is based on StringWriter
but backed by a
StringBuilder
instead.
This class is not thread safe.
Modifier and Type | Field and Description |
---|---|
protected StringBuilder |
builder |
Constructor and Description |
---|
FastStringWriter()
Constructs a new
FastStringWriter instance
using the default capacity of 16 . |
FastStringWriter(int initialCapacity)
Constructs a new
FastStringWriter instance
using the specified initialCapacity . |
Modifier and Type | Method and Description |
---|---|
void |
close()
This is a no-op.
|
void |
flush()
This is a no-op.
|
StringBuilder |
getBuffer()
Return the
StringBuilder itself. |
void |
reset() |
String |
toString() |
void |
write(char[] cbuf,
int off,
int len)
Write a portion of an array of characters.
|
void |
write(String str)
Write a string.
|
void |
write(String str,
int off,
int len)
Write a portion of a string.
|
protected StringBuilder builder
public FastStringWriter()
Constructs a new FastStringWriter
instance
using the default capacity of 16
.
public FastStringWriter(int initialCapacity)
Constructs a new FastStringWriter
instance
using the specified initialCapacity
.
initialCapacity
- specifies the initial capacity of the bufferIllegalArgumentException
- if initialCapacity is less than zeropublic void write(char[] cbuf, int off, int len) throws IOException
Write a portion of an array of characters.
write
in class Writer
cbuf
- Array of charactersoff
- Offset from which to start writing characterslen
- Number of characters to writeIOException
public void flush() throws IOException
This is a no-op.
flush
in interface Flushable
flush
in class Writer
IOException
public void close() throws IOException
This is a no-op.
close
in interface Closeable
close
in interface AutoCloseable
close
in class Writer
IOException
public void write(String str)
public void write(String str, int off, int len)
public StringBuilder getBuffer()
StringBuilder
itself.public String toString()
public void reset()
Comments to: faces-dev@eclipse.org.
Copyright © 2019 Eclipse Foundation. All rights reserved.
Use is subject to license terms.