abstract class FileCopyUtils
Simple utility methods for file and stream copying. All copy methods use a block size of 4096 bytes, and close all affected streams when done. A variation of the copy methods from this class that leave streams open can be found in StreamUtils.
Mainly for use within the framework, but also useful for application code.
Author
Juergen Hoeller
Since
06.10.2003
See Also
StreamUtilsFileSystemUtils
FileCopyUtils()
Simple utility methods for file and stream copying. All copy methods use a block size of 4096 bytes, and close all affected streams when done. A variation of the copy methods from this class that leave streams open can be found in StreamUtils. Mainly for use within the framework, but also useful for application code. |
static val BUFFER_SIZE: Int |
open static fun copy(in: File, out: File): Int
Copy the contents of the given input File to the given output File. open static fun copy(in: ByteArray, out: File): Unit
Copy the contents of the given byte array to the given output File. 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. 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. open static fun copy(in: Reader, out: Writer): Int
Copy the contents of the given Reader to the given Writer. Closes both when done. 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. |
|
open static fun copyToByteArray(in: File): ByteArray
Copy the contents of the given input File into a new byte array. open static fun copyToByteArray(in: InputStream): ByteArray
Copy the contents of the given InputStream into a new byte array. Closes the stream when done. |
|
open static fun copyToString(in: Reader): String
Copy the contents of the given Reader into a String. Closes the reader when done. |