write

abstract fun write(path: String, data: InputStream): Path

Writes the contents of the given stream to the file at the given path.

If the given path points to a file that already exists, it will be truncated before writing.

If the given path points to a file that does not yet exist, it will be created.

Return

Path to the written file.

Parameters

path

Relative path at which the file should be written.

If this path includes subdirectories, those subdirectories will be created if they do not already exist.

data

Input stream over the data that will be written to the target file.


abstract fun write(path: String, consumer: Consumer<OutputStream>): Path

Opens an output stream to the given path and passes it to the consumer, which can write arbitrary data to the file, then closes the stream.

If the given path points to a file that already exists, it will be truncated before writing.

If the given path points to a file that does not yet exist, it will be created.

Return

Path to the written file.

Parameters

path

Relative path at which the file should be written.

If this path includes subdirectories, those subdirectories will be created if they do not already exist.

consumer

Consumer of the created output stream which will write data to the target file via the stream.


abstract fun write(path: String, data: Reader): Path

Writes the contents of the given reader to the file at the given path.

If the given path points to a file that already exists, it will be truncated before writing.

If the given path points to a file that does not yet exist, it will be created.

Return

Path to the written file.

Parameters

path

Relative path at which the file should be written.

If this path includes subdirectories, those subdirectories will be created if they do not already exist.

data

Reader over the data that will be written to the target file.


abstract fun write(path: String, data: String): Path

Writes the given string to the file at the given path.

If the given path points to a file that already exists, it will be truncated before writing.

If the given path points to a file that does not yet exist, it will be created.

Return

Path to the written file.

Parameters

path

Relative path at which the file should be written.

If this path includes subdirectories, those subdirectories will be created if they do not already exist.

data

String that will be written to the target file.


abstract fun write(path: String, data: JsonNode): Path

Writes the given JsonNode to the file at the given path.

If the given path points to a file that already exists, it will be truncated before writing.

If the given path points to a file that does not yet exist, it will be created.

Return

Path to the written file.

Parameters

path

Relative path at which the file should be written.

If this path includes subdirectories, those subdirectories will be created if they do not already exist.

data

Json data that will be written to the target file.