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) voidclose()voidflush()voidwrite(char[] value, int offset, int length) void
-
Constructor Details
-
AppendWriter
Constructs a newStringBuilderinstance with default capacity.
-
-
Method Details
-
append
Appends a single character to this Writer.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Parameters:
value- The character to append- Returns:
- This writer instance
- Throws:
IOException
-
append
Appends a character sequence to this Writer.- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Parameters:
value- The character to append- Returns:
- This writer instance
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
write
- Overrides:
writein classWriter- Throws:
IOException
-
write
- Specified by:
writein 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
-