62,614
社区成员
发帖
与我相关
我的任务
分享
while ((c = is.read(bytes)) != -1)
{
os.write(bytes, 0, c);
os.flush();
}
os.flush();
while ((c = is.read(bytes)) != -1)
{
os.write(bytes, 0, c);
// os.flush();
}
os.flush();
while ((c = is.read(bytes)) != -1)
{
os.write(bytes, 0, c);
// os.flush();
}
// os.flush();
System.out.println("开始创建远程文件...");
TelnetOutputStream os = ftpClient.put(remotefilename);
System.out.println("远程文件创建成功。");
File file_in = new java.io.File(localfilename);
FileInputStream is = new FileInputStream(file_in);
byte[] bytes = new byte[1024];
int c;
while ((c = is.read(bytes)) != -1)
{
os.write(bytes, 0, c);
os.flush();
// try
// {
// Thread.currentThread().sleep(1000);
// }
// catch (InterruptedException e)
// {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
System.out.println("upload success");
if(is!=null)
is.close();
if(os!=null)
os.close();