spring-framework / org.springframework.util / FileCopyUtils / copy

copy

open static fun copy(in: File, out: File): Int

Copy the contents of the given input File to the given output File.

Parameters

in - the file to copy from

out - the file to copy to

Exceptions

IOException - in case of I/O errors

Return
the number of bytes copied

open static fun copy(in: ByteArray, out: File): Unit

Copy the contents of the given byte array to the given output File.

Parameters

in - the byte array to copy from

out - the file to copy to

Exceptions

IOException - in case of I/O errors

open static fun copy(in: InputStream, out: OutputStream): Int

Copy the contents of the given InputStream to the given OutputStream. Closes both streams when done.

Parameters

in - the stream to copy from

out - the stream to copy to

Exceptions

IOException - in case of I/O errors

Return
the number of bytes copied

open static fun copy(in: ByteArray, out: OutputStream): Unit

Copy the contents of the given byte array to the given OutputStream. Closes the stream when done.

Parameters

in - the byte array to copy from

out - the OutputStream to copy to

Exceptions

IOException - in case of I/O errors

open static fun copy(in: Reader, out: Writer): Int

Copy the contents of the given Reader to the given Writer. Closes both when done.

Parameters

in - the Reader to copy from

out - the Writer to copy to

Exceptions

IOException - in case of I/O errors

Return
the number of characters copied

open static fun copy(in: String, out: Writer): Unit

Copy the contents of the given String to the given output Writer. Closes the writer when done.

Parameters

in - the String to copy from

out - the Writer to copy to

Exceptions

IOException - in case of I/O errors