Package xapi.dev.source
Class CharBuffer
java.lang.Object
xapi.dev.source.CharBuffer
- All Implemented Interfaces:
Coercible
- Direct Known Subclasses:
PrintBuffer
A lightweight utility to assemble strings using a graph of linked nodes,
so you can easily "tear off" a pointer in the buffer, and generate text from multiple locations at once.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCharBuffer(String text) CharBuffer(StringBuilder target) CharBuffer(CharBuffer preamble) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToBeginning(CharBuffer buffer) voidaddToEnd(CharBuffer buffer) append(char... chars) clear()booleanisEmpty()ln()protected CharBuffernewChild()protected CharBuffernewChild(StringBuilder suffix) voidonAppend()printAfter(String suffix) Append the given string, and return a printbuffer to append to this point.printBefore(String prefix) setDefaultSource(CharSequence defaultSource) setDefaultSource(Supplier<String> defaultSource) toSource()final StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface xapi.fu.Coercible
coerce, coerce, coerce, coerceNonArray, isAddNewlines, listSeparator, perIndent
-
Field Details
-
indent
-
-
Constructor Details
-
CharBuffer
public CharBuffer() -
CharBuffer
-
CharBuffer
-
CharBuffer
-
-
Method Details
-
newChild
-
newChild
-
onAppend
public void onAppend() -
append
-
append
-
append
-
addToBeginning
-
printBefore
-
printAfter
Append the given string, and return a printbuffer to append to this point.- Parameters:
suffix- The text to append- Returns:
- A buffer pointed at this text, capable of further before/after branching
-
clear
-
addToEnd
-
add
-
ln
-
toString
-
toSource
-
isEmpty
public boolean isEmpty() -
setDefaultSource
-
setDefaultSource
-