AppendableWriter

com.phasmidsoftware.visitor.misc.AppendableWriter
See theAppendableWriter companion object
case class AppendableWriter(writer: Writer)(closeable: Option[AutoCloseable]) extends Appendable[String]

AppendableWriter is a case class that wraps a Writer instance, enabling string appending functionality along with proper resource management.

This class implements the Appendable trait specialized for String, providing an efficient way to append strings to an underlying writer.

The closeable parameter is an optional resource that will be closed when the close method is invoked, ensuring that any additional resources associated with the writer are properly released.

Value parameters

closeable

an optional AutoCloseable resource that will be closed along with the writer

writer

the underlying Writer instance to which strings are appended

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Appendable[String]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def append(x: String): Appendable[String]

Appends the specified string to this AppendableWriter instance. The string is written to the underlying BufferedWriter, and the current instance is returned to enable method chaining.

Appends the specified string to this AppendableWriter instance. The string is written to the underlying BufferedWriter, and the current instance is returned to enable method chaining.

Value parameters

x

the string to be appended to the AppendableWriter

Attributes

Returns

the current AppendableWriter instance with the appended string

def close(): Unit

Closes the underlying BufferedWriter.

Closes the underlying BufferedWriter.

This method ensures that any resources associated with the writer are released and any data still present in the buffer is flushed before closing.

Attributes

Returns

Unit.

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