public static final class CharsWrapper.Builder extends java.io.Writer implements CharacterOutput
| Constructor and Description |
|---|
Builder(int initialCapacity)
Creates a new CharsWrapper's builder with the specified initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
CharsWrapper.Builder |
append(char... chars)
Appends a char array to this builder.
|
CharsWrapper.Builder |
append(char c) |
CharsWrapper.Builder |
append(char[] chars,
int begin,
int end)
Appends a portion of a char array to this builder.
|
CharsWrapper.Builder |
append(java.lang.CharSequence csq) |
CharsWrapper.Builder |
append(java.lang.CharSequence csq,
int start,
int end) |
CharsWrapper.Builder |
append(CharsWrapper cw)
Appends a CharsWrapper to this builder.
|
CharsWrapper.Builder |
append(java.lang.Object... objects)
Appends multiple objects to this builder.
|
CharsWrapper.Builder |
append(java.lang.Object o)
Appends the string representation of an object to this builder.
|
CharsWrapper.Builder |
append(java.lang.String str)
Appends a String to this builder.
|
CharsWrapper.Builder |
append(java.lang.String str,
int begin,
int end)
Appends a String to this builder.
|
CharsWrapper |
build()
Builds a CharsWrapper with the content of this builder.
|
CharsWrapper |
build(int start)
Builds a CharsWrapper with the content of this builder.
|
CharsWrapper |
build(int start,
int end)
Builds a CharsWrapper with the content of this builder.
|
void |
close() |
void |
compact()
Compacts this builder, minimizing its size in memory.
|
CharsWrapper |
copyAndBuild()
Builds a CharsWrapper with a copy of the content of this builder.
|
CharsWrapper |
copyAndBuild(int start)
Builds a CharsWrapper with a copy of the content of this builder.
|
CharsWrapper |
copyAndBuild(int start,
int end)
Builds a CharsWrapper with a copy of the content of this builder.
|
void |
flush() |
char |
get(int index) |
char[] |
getChars()
Gets the underlying array of this builder.
|
int |
length()
Gets the length (number of characters) of this builder.
|
void |
set(int index,
char ch)
Sets the value of a character.
|
java.lang.String |
toString() |
java.lang.String |
toString(int start) |
java.lang.String |
toString(int start,
int end) |
void |
write(char... cbuf)
Writes an array of characters.
|
void |
write(char c)
Writes a character.
|
void |
write(char[] chars,
int offset,
int length)
Writes a portion of an array of characters.
|
void |
write(CharsWrapper cw)
Writes all the characters in the given CharsWrapper.
|
void |
write(int c) |
void |
write(java.lang.String str)
Writes all the characters in the given String.
|
void |
write(java.lang.String s,
int offset,
int length)
Writes a portion of a String.
|
public Builder(int initialCapacity)
initialCapacity - the initial capacitypublic CharsWrapper.Builder append(char c)
append in interface java.lang.Appendableappend in class java.io.Writerpublic CharsWrapper.Builder append(java.lang.CharSequence csq)
append in interface java.lang.Appendableappend in class java.io.Writerpublic CharsWrapper.Builder append(java.lang.CharSequence csq, int start, int end)
append in interface java.lang.Appendableappend in class java.io.Writerpublic CharsWrapper.Builder append(char... chars)
chars - the array to append, not nullpublic CharsWrapper.Builder append(char[] chars, int begin, int end)
chars - the array to append, not nullbegin - the index to start atend - the index to stop at (exclusive)public CharsWrapper.Builder append(java.lang.String str)
str - the String to append, not nullpublic CharsWrapper.Builder append(java.lang.String str, int begin, int end)
str - the String to append, not nullbegin - the index to start atend - the index to stop at (exclusive)public CharsWrapper.Builder append(CharsWrapper cw)
cw - the wrapper to append, not nullpublic CharsWrapper.Builder append(java.lang.Object o)
append(String.valueOf(o)).o - the object to append, may be nullpublic CharsWrapper.Builder append(java.lang.Object... objects)
append(String.valueOf(o)) in a loop.objects - the objects to append, may be nullpublic void flush()
flush in interface java.io.Flushableflush in class java.io.Writerpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Writerpublic void write(int c)
write in class java.io.Writerpublic void write(char c)
CharacterOutputwrite in interface CharacterOutputc - the character to writepublic void write(char... cbuf)
CharacterOutputwrite in interface CharacterOutputwrite in class java.io.Writercbuf - the characters to writepublic void write(char[] chars,
int offset,
int length)
CharacterOutputwrite in interface CharacterOutputwrite in class java.io.Writerchars - the characters to writeoffset - the index to start atlength - the number of characters to writepublic void write(java.lang.String str)
CharacterOutputwrite in interface CharacterOutputwrite in class java.io.Writerstr - the string to writepublic void write(java.lang.String s,
int offset,
int length)
CharacterOutputwrite in interface CharacterOutputwrite in class java.io.Writers - the string to writeoffset - the index to start atlength - the number of characters to writepublic void write(CharsWrapper cw)
CharacterOutputwrite in interface CharacterOutputcw - the CharsWrapper to writepublic int length()
public char[] getChars()
public char get(int index)
index - the character's index (the first character is at index 0)public void set(int index,
char ch)
index - the character's index (the first character is at index 0)ch - the character value to setpublic void compact()
public CharsWrapper build()
public CharsWrapper build(int start)
start - index of the 1st character to usepublic CharsWrapper build(int start, int end)
start - index of the 1st character to useend - index after the last character to usepublic CharsWrapper copyAndBuild()
public CharsWrapper copyAndBuild(int start)
start - index of the 1st character to usepublic CharsWrapper copyAndBuild(int start, int end)
start - index of the 1st character to useend - index after the last character to usepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(int start)
public java.lang.String toString(int start,
int end)