AppendableWriter

com.phasmidsoftware.visitor.misc.AppendableWriter
See theAppendableWriter companion class

Companion object for AppendableWriter providing factory methods for creating instances.

The AppendableWriter allows for efficient and convenient appending of string data to files or other writable resources via a BufferedWriter. The factory methods in the companion object ensure flexibility by enabling creation from file names, File instances, FileWriter objects, or directly from BufferedWriter instances.

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply(name: String): AppendableWriter

Creates an AppendableWriter instance for the given file name.

Creates an AppendableWriter instance for the given file name.

The file name must not be null or empty and should start with a forward slash ("/") and end with ".txt". If these conditions are not met, an IllegalArgumentException will be thrown. This method internally constructs a File instance and delegates creation to another apply method.

Value parameters

name

the name of the file (must be non-null, non-empty, start with "/", and end with ".txt")

Attributes

Returns

an AppendableWriter instance associated with the specified file

Throws
IllegalArgumentException

if name is null, empty, does not start with "/", or does not end with ".txt"

def apply(file: File): AppendableWriter

Creates an AppendableWriter instance using the specified File.

Creates an AppendableWriter instance using the specified File.

This method initializes a FileWriter in append-mode for the provided file and then uses it to create an AppendableWriter instance.

Value parameters

file

the file to which the AppendableWriter will append data

Attributes

Returns

an instance of AppendableWriter that writes to the specified file in append-mode

def apply(fileWriter: FileWriter): AppendableWriter

Creates a new instance of AppendableWriter using the provided FileWriter.

Creates a new instance of AppendableWriter using the provided FileWriter.

The AppendableWriter wraps the FileWriter with a BufferedWriter, enabling efficient writing operations, and provides an interface for appending string content.

Value parameters

fileWriter

the FileWriter to be wrapped, enabling appending functionality to the file

Attributes

Returns

a new AppendableWriter instance wrapping the provided FileWriter

Creates a new instance of AppendableWriter with a default StringWriter as the underlying writer.

Creates a new instance of AppendableWriter with a default StringWriter as the underlying writer.

This method provides a convenient way to construct an AppendableWriter in-memory without specifying a file or an external writer.

Attributes

Returns

a new AppendableWriter instance wrapping a default StringWriter