Package tools.common
Class TextBuilder
java.lang.Object
tools.common.TextBuilder
- All Implemented Interfaces:
CharSequence
Building a text.
Usage
String result = new TextBuilder()
.line("A", "B", "C").add("\n")
.line("X", "Y").add("Z")
.toString();
String expected = "ABC\nXYZ";
assertEquals(expected, result);
- Author:
- Pavel Ponec
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(@NotNull CharSequence... items) protected final booleanfinal charcharAt(int index) booleanisEmpty()final intlength()line(@NotNull CharSequence... items) final CharSequencesubSequence(int from, int to) @NotNull StringtoString()voidwriteTo(@NotNull Appendable writer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
codePoints, chars
-
Field Details
-
NEW_LINE
public static final char NEW_LINE- See Also:
-
-
Constructor Details
-
TextBuilder
public TextBuilder() -
TextBuilder
-
-
Method Details
-
add
-
line
-
emptyLine
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCharSequence
-
endsByNewLine
protected final boolean endsByNewLine() -
writeTo
- Throws:
IOException
-
length
public final int length()- Specified by:
lengthin interfaceCharSequence
-
charAt
public final char charAt(int index) - Specified by:
charAtin interfaceCharSequence
-
subSequence
- Specified by:
subSequencein interfaceCharSequence
-
toString
- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-