File.lockingTextWriter

auto lockingTextWriter() @safe

Output range which locks the file when created, and unlocks the file when it goes out of scope.

Returns

An output range

which accepts string types, ubyte[], individual character types, and individual ubytes.

Note

Writing either arrays of chars or ubytes is faster than

writing each character individually from a range. For large amounts of data, writing the contents in chunks using an intermediary array can result in a speed increase.

Throws

UTFException if the data given is a char range

and it contains malformed UTF data.

See Also

byChunk for an example.