copyTo
Copies this stream to the given output stream, returning the number of bytes copied
Note It is the caller's responsibility to close both of these resources.
Since Kotlin
1.0Copies this reader to the given out writer, returning the number of characters copied.
Note it is the caller's responsibility to close both of these resources.
Since Kotlin
1.0Return
number of characters copied.
Parameters
writer to write to.
size of character buffer to use in process.
Copies this file to the given target file.
If some directories on a way to the target are missing, then they will be created. If the target file already exists, this function will fail unless overwrite argument is set to true
.
When overwrite is true
and target is a directory, it is replaced only if it is empty.
If this file is a directory, it is copied without its content, i.e. an empty target directory is created. If you want to copy directory including its contents, use copyRecursively.
The operation doesn't preserve copied file attributes such as creation/modification date, permissions, etc.
Since Kotlin
1.0Return
the target file.
Parameters
true
if destination overwrite is allowed.
the buffer size to use when copying.
Throws
if the source file doesn't exist.
if the destination file already exists and overwrite argument is set to false
.
if any errors occur while copying.