INNER CODE UNIT · Java

copyFileUsingStream

Tencent/VasDolly · command/src/main/java/com/tencent/vasdolly/command/Util.java:369

    public static void copyFileUsingStream(File source, File dest) throws IOException {
        FileInputStream is = null;
        FileOutputStream os = null;
        File parent = dest.getParentFile();
        if (parent != null && (!parent.exists())) {
            parent.mkdirs();
        }
        try {
            is = new FileInputStream(source);
            os = new FileOutputStream(dest, false);

            byte[] buffer = new byte[4096];
            int length;
            while ((length = is.read(buffer)) > 0) {
                os.write(buffer, 0, length);
            }
        } finally {
            if (is != null) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…