Android 台灣中文網

標題: 檔案傳輸儲存問題 [打印本頁]

作者: ya162000    時間: 2017-11-24 09:09
標題: 檔案傳輸儲存問題


小弟我用 samba 將遠端電腦共用資料夾的檔案傳回開發板儲存
但是存在Storage沒問題 存在SD Card就沒反應
改怎麼辦才能存在SD CARD?

try{
    String url = "smb://192.168.1.111/test.txt";
    SmbFile sfile = new SmbFile(url);
    SmbFileInputStream sfis = null;
    FileOutputStream fos = null;
    try {
        sfis = new SmbFileInputStream(sfile);
        fos = new FileOutputStream(new File("/storage/emulated/0", "text.txt"));

        byte[] buf = new byte[4096];
        int len;
        while(( len = sfis.read(buf) )> 0 ){
            fos.write(buf, 0, len);
        }
         sfis.close();         fos.close();      }
}catch(Exception e){
}





歡迎光臨 Android 台灣中文網 (https://apk.tw/) Powered by Discuz! X3.1