Convert SmbFile to Java IO File

后端 未结 5 1307
隐瞒了意图╮
隐瞒了意图╮ 2021-01-02 16:37

My Java application requires access to a large excel file (1GB+ in size) saved on remote shared folder. I\'m using SmbFile to get the file with authenticati

5条回答
  •  南笙
    南笙 (楼主)
    2021-01-02 16:53

        jcifs.smb.SmbFile smbFile = new SmbFile("smb://host/fileShare/.../file");
        java.io.File javaFile = new File(smbFile.getUncPath());
    
        System.out.println(smbFile);
        System.out.println(javaFile);
    

    Output

    smb://host/fileShare/.../file
    \\host\fileShare\...\file
    

    javadoc of smbFile.getUncPath() says

    Retuns the Windows UNC style path with backslashs intead of forward slashes.

    I am using jcifs-1.3.17.jar on Windows 10.

提交回复
热议问题