// jt.smbPut("smb://administrator:Jqwl0102@172.168.11.138/BMS_FILE",
// "E:/1-vtradex/test.txt");//OK
public static void smbPut(String remoteUrl, String localFilePath) {
InputStream in = null ;
OutputStream out = null ;
try {
File localFile = new File(localFilePath);
String fileName = localFile.getName();
SmbFile remoteFile = new SmbFile(remoteUrl + "/" + fileName);
in = new BufferedInputStream( new FileInputStream(localFile));
out = new BufferedOutputStream( new SmbFileOutputStream(remoteFile));
byte [] buffer = new byte [ 1024 ];
while (in.read(buffer) != - 1 ) {
out.write(buffer);
buffer = new byte [ 1024 ];
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if(out!=null){
out.close();
}
if(in!=null){
in.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}