使用 JCIFS 性能问题将文件从本地驱动器复制到共享驱动器

Copy a file from local drive to share drive using JCIFS performance issue

我正在使用以下 JCIFS 代码将文件从本地磁盘复制到共享驱动器

public boolean copyFiles(String srcFilePath, String destinationFileName) throws Exception {
    boolean successful = false;
    SmbFileOutputStream sfos = null;

    try {
        String user = USER_NAME + ":" + PASSWORD;
        System.out.println("User: " + user);

        NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("mydomain",USER_NAME,PASSWORD);
        Config.setProperty("resolveOrder", "DNS");

        String destinationFilePath = NETWORK_FOLDER +"/" +destinationFileName;

        SmbFile sFile = new SmbFile(destinationFilePath, auth);
        sfos = new SmbFileOutputStream(sFile);
    // sfos.write(getBytesFromFile(new File(srcFilePath))); -- 1st approach
       // Files.copy(new File(srcFilePath).toPath(),sfos); -- 2nd approach
        FileInputStream fis = new FileInputStream(srcFilePath);

        BufferedReader brl = new BufferedReader(new InputStreamReader(fis));
        String b = null;
        while ((b = brl.readLine()) != null) {
            sfos.write(b.getBytes());
        }
        sfos.flush();

        successful = true;
        System.out.println("Successful" + successful);
    } catch (Exception e) {
        successful = false;
        e.printStackTrace();
    } finally {
        if (sfos != null) {
            sfos.close();
        }
    }
    return successful;
}

复制 10 MB 的文件需要 10 多分钟。而当我直接复制同一个文件时,大约需要 1 分钟。我尝试了 3 种方法来复制文件(请参阅代码的注释部分),但其中 none 显示出任何显着差异。

有没有办法提高 JCIFS 的性能?

作为解决方法,我已经安装了共享驱动器并将文件复制到该驱动器中。