我上傳100kb
到samba的圖片與我的平板電腦上的JCIFS共享時出現問題,需要大約10-20分鐘(之前我從1024 to 20971520
更改了我的緩衝區花了近6個小時),但它沒有給出任何影響再增加它Android上傳到網絡驅動器(samba共享)性能問題
它不是連接問題,因爲我有ES File
它上傳我的照片立即
private class MyCopy extends AsyncTask<String, String, String> {
String z = "";
String username = "", password = "", servername = "", filestocopy = "";
@Override
protected void onPreExecute() {
username = edtusername.getText().toString();
password = edtpassword.getText().toString();
servername = "smb://" + edtservername.getText().toString();
filestocopy = editdir.getText().toString();
}
protected String doInBackground(String... params) {
// String buffer;
// buffer = setingPreferences.getString("buffer", "");
File file = new File(filestocopy);
String filename = file.getName();
NtlmPasswordAuthentication auth1 = new NtlmPasswordAuthentication(
servername, username, password);
try {
SmbFile sfile = new SmbFile(servername + "/" + filename, auth1);
if (!sfile.exists())
sfile.createNewFile();
sfile.connect();
InputStream in = new FileInputStream(file);
SmbFileOutputStream sfos = new SmbFileOutputStream(sfile);
byte[] buf = new byte[20971520]; //(parseInt(buffer))
int len;
while ((len = in.read(buf)) > 0){
sfos.write(buf, 0, len);
}
in.close();
sfos.close();
z = "File copied successfully";
} catch (Exception ex) {
z = z + " " + ex.getMessage().toString();
}
return z;
}
}
您是否嘗試過在J2SE環境中使用JCIFS來檢查它是Android問題還是JCIFS問題?這個庫看起來很舊(最後一次真正的更新2011)... – Robert