package com.xt.db.oracle;
import sun.net.TelnetOutputStream;
import sun.net.ftp.FtpClient;
public class FTPUploader
{
public FTPUploader()
{
}
public void putFileOverFTP(byte dataBytes[], int startpos, int endpos, String saveFile, String tip)
throws Exception
{
String server = "";
if("1".equals(tip))
server = "165.198.192.238";
else if("2".equals(tip))
server = "165.198.192.246";
String user = "xttest";
String passwd = "XTtest3";
FtpClient ftpClient = new FtpClient();
ftpClient.openServer(server);
ftpClient.login(user, passwd);
ftpClient.cd("/");
ftpClient.cd("/usr/tmp");
ftpClient.ascii();
//ftpClient.binary();
TelnetOutputStream netOut = ftpClient.put(saveFile);
netOut.write(dataBytes, startpos, endpos);
netOut.close();
ftpClient.closeServer();
}
}
Hiç yorum yok:
Yorum Gönder