java jcifs出错,java.io.IOException: Invalid payload size: 405
jcifs.smb.SmbException
jcifs.util.transport.TransportException
java.io.IOException: Invalid payload size: 405
at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:279)
at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:306)
at jcifs.util.transport.Transport.run(Transport.java:240)
at java.lang.Thread.run(Thread.java:722)
at jcifs.util.transport.Transport.run(Transport.java:256)
at java.lang.Thread.run(Thread.java:722)
at jcifs.smb.SmbTransport.connect(SmbTransport.java:296)
at jcifs.smb.SmbTree.treeConnect(SmbTree.java:141)
at jcifs.smb.SmbFile.doConnect(SmbFile.java:858)
at jcifs.smb.SmbFile.connect(SmbFile.java:901)
at jcifs.smb.SmbFile.connect0(SmbFile.java:827)
at jcifs.smb.SmbFile.open0(SmbFile.java:917)
at jcifs.smb.SmbFile.open(SmbFile.java:951)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:142)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:97)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:67)
public static void main(String[] args) {
//无密码
getShareFile("smb://192.168.0.103/msgFloder/msg1.txt", "D:/test");
}
public static void getShareFile(String remoteUrl, String savePath) {
try {
SmbFile smbFile = new SmbFile(remoteUrl);
if (smbFile != null) {
String fileName = smbFile.getName();
File localFile = new File(savePath + File.separator + fileName);
InputStream is = new BufferedInputStream(new SmbFileInputStream(smbFile));
OutputStream os = new BufferedOutputStream(new FileOutputStream(localFile));
byte[] bytes = new byte[1024];
while (is.read(bytes) != -1) {
os.write(bytes);
}
os.flush();
os.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决没有???