Package org.apache.commons.io.output
Class AppendableOutputStream<T extends java.lang.Appendable>
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.commons.io.output.AppendableOutputStream<T>
-
- Type Parameters:
T- The type of theAppendablewrapped by this AppendableOutputStream.
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class AppendableOutputStream<T extends java.lang.Appendable> extends java.io.OutputStreamOutputStream implementation that writes the data to anAppendableObject.For example, can be used with any
Writeror aStringBuilderorStringBuffer.- Since:
- 2.5
- See Also:
Appendable
-
-
Constructor Summary
Constructors Constructor Description AppendableOutputStream(T appendable)Construct a new instance with the specified appendable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TgetAppendable()Return the target appendable.voidwrite(int b)Write a character to the underlying appendable.
-
-
-
Constructor Detail
-
AppendableOutputStream
public AppendableOutputStream(T appendable)
Construct a new instance with the specified appendable.- Parameters:
appendable- the appendable to write to
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOExceptionWrite a character to the underlying appendable.- Specified by:
writein classjava.io.OutputStream- Parameters:
b- the character to write- Throws:
java.io.IOException- upon error
-
getAppendable
public T getAppendable()
Return the target appendable.- Returns:
- the target appendable
-
-