
从郑团凳共享目录下载文件
public static void smbGet(String remoteUrl,String localDir) {
InputStream in = null
OutputStream out = null
try {
SmbFile remoteFile = new SmbFile(remoteUrl)
if(remoteFile==null){
System.out.println("共享文件不存在")
return
}
String fileName = remoteFile.getName()
File localFile = new File(localDir+File.separator+fileName)
in = new BufferedInputStream(new SmbFileInputStream(remoteFile))
out = new BufferedOutputStream(new FileOutputStream(localFile))
byte[] buffer = new byte[1024]
while(in.read(buffer)!=-1){
out.write(buffer)
buffer = new byte[1024]
}
} catch (Exception e) {
e.printStackTrace()
} finally {
try {
out.close()
in.close()
} catch (IOException e) {
e.printStackTrace()
}
}
}
你的smb.conf文件里是不是猛戚下载模式设置错了? 看你的内容好像裂知核下载了一半然后出错了,先试试一个小一点的文肆掘本文件,看能不能下载。然后再说好吗。。。求采纳
1、首凯模先唯肢设置电脑端,鼠标共享文件右键-属性。
2、点共享,添加,EVeryone 用户。
3、然后手机端下载ES文件浏览器。
4、打开ES文件浏览器,在主界面-点击左侧的列表。
5、然后在列表下,找到并点击-局域网选项。
6、然后在局域网盯山缓选项里点下方的-扫描选项。
7、最后找到共享电脑-进入共享文件夹就完成了。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)