我只是在考驗JCIFS訪問Windows共享太慢。它完全無法使用的速度非常緩慢。JCIFS:文件檢索是要使用
import jcifs.smb.*;
class First {
public static void main(String[] args) throws Exception {
try {
//jcifs.Config.setProperty("jcifs.netbios.wins", "192.168.1.220");
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("domain.com", "Administrator", "password");
SmbFile f = new SmbFile("smb://10.17.15.12/Share/xml/file.xml", auth);
SmbFileInputStream in = new SmbFileInputStream(f);
byte[] b = new byte[8192];
int n;
while((n = in.read(b)) > 0) {
System.out.write(b, 0, n);
}
} catch (SmbException smbe) {
System.err.println(smbe.getNtStatus());
System.err.println(smbe.toString());
System.err.println(smbe.getCause());
}
}
}
初始輸出需要很長時間,後續讀取也很慢。任何想法如何使用它?由此我可以編寫Java代碼來訪問Windows共享在便攜方式的任何替代方案,也歡迎
我知道這是一箇舊的答案,但源代碼鏈接似乎已經過時。 – Vish