Package org.apache.commons.io.output
Class AppendableWriter<T extends Appendable>
java.lang.Object
java.io.Writer
org.apache.commons.io.output.AppendableWriter<T>
- Type Parameters:
- T- The type of the- Appendablewrapped by this AppendableWriter.
- All Implemented Interfaces:
- Closeable,- Flushable,- Appendable,- AutoCloseable
Writer implementation that writes the data to an 
Appendable
 Object.
 
 For example, can be used with a StringBuilder
 or StringBuffer.
 
- Since:
- 2.7
- See Also:
- 
Field Summary
- 
Constructor SummaryConstructorsConstructorDescriptionAppendableWriter(T appendable) Constructs a new instance with the specified appendable.
- 
Method SummaryModifier and TypeMethodDescriptionappend(char c) Appends the specified character to the underlying appendable.append(CharSequence csq) Appends the specified character sequence to the underlying appendable.append(CharSequence csq, int start, int end) Appends a subsequence of the specified character sequence to the underlying appendable.voidclose()Closes the stream.voidflush()Flushes the stream.Gets the target appendable.voidwrite(char[] cbuf, int off, int len) Writes a portion of an array of characters to the underlying appendable.voidwrite(int c) Writes a character to the underlying appendable.voidWrites a portion of a String to the underlying appendable.
- 
Constructor Details- 
AppendableWriterConstructs a new instance with the specified appendable.- Parameters:
- appendable- the appendable to write to
 
 
- 
- 
Method Details- 
appendAppends the specified character to the underlying appendable.- Specified by:
- appendin interface- Appendable
- Overrides:
- appendin class- Writer
- Parameters:
- c- the character to append
- Returns:
- this writer
- Throws:
- IOException- upon error
 
- 
appendAppends the specified character sequence to the underlying appendable.- Specified by:
- appendin interface- Appendable
- Overrides:
- appendin class- Writer
- Parameters:
- csq- the character sequence to append
- Returns:
- this writer
- Throws:
- IOException- upon error
 
- 
appendAppends a subsequence of the specified character sequence to the underlying appendable.- Specified by:
- appendin interface- Appendable
- Overrides:
- appendin class- Writer
- Parameters:
- csq- the character sequence from which a subsequence will be appended
- start- the index of the first character in the subsequence
- end- the index of the character following the last character in the subsequence
- Returns:
- this writer
- Throws:
- IOException- upon error
 
- 
closeCloses the stream. This implementation does nothing.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein class- Writer
- Throws:
- IOException- upon error
 
- 
flushFlushes the stream. This implementation does nothing.- Specified by:
- flushin interface- Flushable
- Specified by:
- flushin class- Writer
- Throws:
- IOException- upon error
 
- 
getAppendableGets the target appendable.- Returns:
- the target appendable
 
- 
writeWrites a portion of an array of characters to the underlying appendable.- Specified by:
- writein class- Writer
- Parameters:
- cbuf- an array with the characters to write
- off- offset from which to start writing characters
- len- number of characters to write
- Throws:
- IOException- upon error
 
- 
writeWrites a character to the underlying appendable.- Overrides:
- writein class- Writer
- Parameters:
- c- the character to write
- Throws:
- IOException- upon error
 
- 
writeWrites a portion of a String to the underlying appendable.- Overrides:
- writein class- Writer
- Parameters:
- str- a string
- off- offset from which to start writing characters
- len- number of characters to write
- Throws:
- IOException- upon error
 
 
-