SmartBuffer

com.phasmidsoftware.xmldoc.core.SmartBuffer
See theSmartBuffer companion object
case class SmartBuffer(sb: StringBuilder)

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 Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def append(s: String): SmartBuffer

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

def appendPadded(s: String): SmartBuffer

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)

def clear: String

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.

def result: String

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

override def toString: String

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

def productElementNames: Iterator[String]

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
def productIterator: Iterator[Any]

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