Package migratedb.v1.core.internal.util
Class FileCopyUtils
java.lang.Object
migratedb.v1.core.internal.util.FileCopyUtils
Utility class for copying files and their contents. Inspired by Spring's own.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcopy(InputStream in, OutputStream out) Copy the contents of the given InputStream to the given OutputStream.static voidCopy the contents of the given Reader to the given Writer.static byte[]Copy the contents of the given InputStream into a new byte array.static StringcopyToString(InputStream in, Charset encoding) Copy the contents of the given InputStream into a new String based on this encoding.static StringcopyToString(Reader in) Copy the contents of the given Reader into a String.
-
Constructor Details
-
FileCopyUtils
public FileCopyUtils()
-
-
Method Details
-
copyToString
Copy the contents of the given Reader into a String. Closes the reader when done.- Parameters:
in- the reader to copy from- Returns:
- the String that has been copied to
- Throws:
IOException- in case of I/O errors
-
copyToByteArray
Copy the contents of the given InputStream into a new byte array. Closes the stream when done.- Parameters:
in- the stream to copy from- Returns:
- the new byte array that has been copied to
- Throws:
IOException- in case of I/O errors
-
copyToString
Copy the contents of the given InputStream into a new String based on this encoding. Closes the stream when done.- Parameters:
in- the stream to copy fromencoding- The encoding to use.- Returns:
- The new String.
- Throws:
IOException- in case of I/O errors
-
copy
Copy the contents of the given Reader to the given Writer. Closes both when done.- Parameters:
in- the Reader to copy fromout- the Writer to copy to- Throws:
IOException- in case of I/O errors
-
copy
Copy the contents of the given InputStream to the given OutputStream. Closes both streams when done.- Parameters:
in- the stream to copy fromout- the stream to copy to- Returns:
- the number of bytes copied
- Throws:
IOException- in case of I/O errors
-