T - The type of the Appendable wrapped by this AppendableWriter.public class AppendableWriter<T extends java.lang.Appendable>
extends java.io.Writer
Appendable
Object.
For example, can be used with a StringBuilder
or StringBuffer.
Appendable| Constructor and Description |
|---|
AppendableWriter(T appendable)
Constructs a new instance with the specified appendable.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.Writer |
append(char c)
Appends the specified character to the underlying appendable.
|
java.io.Writer |
append(java.lang.CharSequence csq)
Appends the specified character sequence to the underlying appendable.
|
java.io.Writer |
append(java.lang.CharSequence csq,
int start,
int end)
Appends a subsequence of the specified character sequence to the underlying appendable.
|
void |
close()
Closes the stream.
|
void |
flush()
Flushes the stream.
|
T |
getAppendable()
Return the target appendable.
|
void |
write(char[] cbuf,
int off,
int len)
Writes a portion of an array of characters to the underlying appendable.
|
void |
write(int c)
Writes a character to the underlying appendable.
|
void |
write(java.lang.String str,
int off,
int len)
Writes a portion of a String to the underlying appendable.
|
public AppendableWriter(T appendable)
appendable - the appendable to write topublic java.io.Writer append(char c)
throws java.io.IOException
append in interface java.lang.Appendableappend in class java.io.Writerc - the character to appendjava.io.IOException - upon errorpublic java.io.Writer append(java.lang.CharSequence csq)
throws java.io.IOException
append in interface java.lang.Appendableappend in class java.io.Writercsq - the character sequence to appendjava.io.IOException - upon errorpublic java.io.Writer append(java.lang.CharSequence csq,
int start,
int end)
throws java.io.IOException
append in interface java.lang.Appendableappend in class java.io.Writercsq - the character sequence from which a subsequence will be appendedstart - the index of the first character in the subsequenceend - the index of the character following the last character in the subsequencejava.io.IOException - upon errorpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Writerjava.io.IOException - upon errorpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.Writerjava.io.IOException - upon errorpublic T getAppendable()
public void write(char[] cbuf,
int off,
int len)
throws java.io.IOException
write in class java.io.Writercbuf - an array with the characters to writeoff - offset from which to start writing characterslen - number of characters to writejava.io.IOException - upon errorpublic void write(int c)
throws java.io.IOException
write in class java.io.Writerc - the character to writejava.io.IOException - upon errorpublic void write(java.lang.String str,
int off,
int len)
throws java.io.IOException
write in class java.io.Writerstr - a stringoff - offset from which to start writing characterslen - number of characters to writejava.io.IOException - upon errorCopyright © 2010 - 2023 Adobe. All Rights Reserved