Package com.randomnoun.common.io
Class AppendWriter
java.lang.Object
java.io.Writer
com.randomnoun.common.io.AppendWriter
- All Implemented Interfaces:
Closeable
,Flushable
,Serializable
,Appendable
,AutoCloseable
A Writer that has the same append() methods as StringBuilder.
This class exists mainly so that I can cut and paste the existing StringBuilder code, but use a Writer backing implementation instead.
Note that these methods may now throw IOExceptions.
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend
(boolean b) append
(char value) Appends a single character to this Writer.append
(char[] str) append
(char[] str, int offset, int len) append
(double d) append
(float f) append
(int i) append
(long lng) append
(CharSequence value) Appends a character sequence to this Writer.append
(StringBuffer sb) void
close()
void
flush()
void
write
(char[] value, int offset, int length) void
-
Constructor Details
-
AppendWriter
Constructs a newStringBuilder
instance with default capacity.
-
-
Method Details
-
append
Appends a single character to this Writer.- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classWriter
- Parameters:
value
- The character to append- Returns:
- This writer instance
- Throws:
IOException
-
append
Appends a character sequence to this Writer.- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classWriter
- Parameters:
value
- The character to append- Returns:
- This writer instance
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classWriter
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classWriter
- Throws:
IOException
-
write
- Overrides:
write
in classWriter
- Throws:
IOException
-
write
- Specified by:
write
in classWriter
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-
append
- Throws:
IOException
-