A utility class that wraps around a StringBuilder and provides additional functionality such as appending strings with optional padding, trimming trailing spaces, and formatting output. Most of the methods appear to be non-mutating pure functions but, in fact, they all take advantage of the mutable nature of SmartBuffer.
Value parameters
- sb
-
the underlying StringBuilder instance.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Method to append a String (delegates to sb.append)
Method to append a String (delegates to sb.append)
Value parameters
- s
-
the String to be appended.
Attributes
Method to append a String (delegates to sb.append) with padding if necessary.
Method to append a String (delegates to sb.append) with padding if necessary.
Value parameters
- s
-
the String to be appended.
Attributes
- Returns
-
this SmartBuffer (mutated)
Clears the internal StringBuilder content while returning the current result.
Clears the internal StringBuilder content while returning the current result.
Attributes
- Returns
-
the result string before the internal StringBuilder is cleared.
Get the resulting String.
Get the resulting String.
NOTE: this method contains a hack which collapses output of the form <tag ...></tag> into <tag .../> As such, it is useful for e.g. hotSpot which has no children.
NOTE: the method assumes there is at most one newline character at the beginning of the string.
Attributes
Returns the string representation of the internal state of this object.
Returns the string representation of the internal state of this object.
Attributes
- Returns
-
the string representation of the internal StringBuilder.
- Definition Classes
-
Any
Trims trailing spaces from the internal StringBuilder of this SmartBuffer.
Trims trailing spaces from the internal StringBuilder of this SmartBuffer.
Attributes
- Returns
-
this SmartBuffer instance after mutating its content.
Inherited methods
An iterator over the names of all the elements of this product.
An iterator over the names of all the elements of this product.
Attributes
- Inherited from:
- Product
An iterator over all the elements of this product.
An iterator over all the elements of this product.
Attributes
- Returns
-
in the default implementation, an
Iterator[Any] - Inherited from:
- Product