java.lang.Object
java.io.Writer
com.sun.faces.io.FastStringWriter
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
This is based on StringWriter
but backed by a StringBuilder
instead.
This class is not thread safe.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs a newFastStringWriter
instance using the default capacity of16
.FastStringWriter
(int initialCapacity) Constructs a newFastStringWriter
instance using the specifiedinitialCapacity
. -
Method Summary
-
Field Details
-
builder
-
-
Constructor Details
-
FastStringWriter
public FastStringWriter()Constructs a new
FastStringWriter
instance using the default capacity of16
. -
FastStringWriter
public FastStringWriter(int initialCapacity) Constructs a new
FastStringWriter
instance using the specifiedinitialCapacity
.- Parameters:
initialCapacity
- specifies the initial capacity of the buffer- Throws:
IllegalArgumentException
- if initialCapacity is less than zero
-
-
Method Details
-
write
Write a portion of an array of characters.
- Specified by:
write
in classWriter
- Parameters:
cbuf
- Array of charactersoff
- Offset from which to start writing characterslen
- Number of characters to write- Throws:
IOException
-
flush
This is a no-op.
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classWriter
- Throws:
IOException
-
close
This is a no-op.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classWriter
- Throws:
IOException
-
write
-
write
-
getBuffer
Return theStringBuilder
itself.- Returns:
- StringBuilder holding the current buffer value.
-
toString
-
reset
public void reset()
-