这是我编写的代码,可以正常运行。
File f=new File("abc.txt"); //Takes the default path, else, you can specify the required pathif(f.exists()){ f.delete();}f.createNewFile(); FileObject destn = VFS.getManager().resolveFile(f.getAbsolutePath());UserAuthenticator auth = new StaticUserAuthenticator("", "myusername", "secret_password");FileSystemOptions opts = new FileSystemOptions();DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);FileObject fo = VFS.getManager().resolveFile("\192.168.0.1\direcory\to\GetData\sourceFile.txt",opts);destn.copyFrom(fo,Selectors.SELECT_SELF);destn.close();
现在,您可以使用该文件执行所需的 *** 作。就像是…
InputStream is = new FileInputStream(f);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)