久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 java 中完成 FTP 后創(chuàng)建 0 kb 文件

0 kb file created once FTP is done in java(在 java 中完成 FTP 后創(chuàng)建 0 kb 文件)
本文介紹了在 java 中完成 FTP 后創(chuàng)建 0 kb 文件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試將文件通過 FTP 傳輸到遠程計算機上.下面是我的代碼:-

I am trying to FTP a file on to a remote machine. Below is my code :-

FTPClient ftpClient = new FTPClient(); 
ftpClient.connect("home.abc.com"); 
ftpClient.login("remote", "guesst12"); 
int replyCode = ftpClient.getReplyCode(); 
ftpClient.changeWorkingDirectory("share")) 
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
InputStream input = new FileInputStream(new File("H:/testFile.txt"));
OutputStream out =  ftpClient.storeFileStream("testFile.txt");
Util.copyStream(input, out);
out.close();
input.close();
ftpClient.completePendingCommand()
ftpClient.logout();
ftpClient.disconnect();

當我執(zhí)行這段代碼時,代碼執(zhí)行沒有任何問題,但是在遠程機器上,當我檢查文件時,正在創(chuàng)建文件,但沒有內容 (OKB) 文件.我在代碼中遺漏了什么嗎?

When i execute this piece of code, the code is executed without any issues, but at the remote machine, when i check the file, the file is being created, but with no content (OKB) file. Am i missing something in code.

[更新]:我嘗試使用以下代碼存儲文件:-

[Update] : I tried with the following code for storing file :-

if(ftpClient.storeFile("testCopy.txt", input)) {
    System.out.println("File Stored Successfully");
}
System.out.println(ftpClient.getReplyString());

現在我收到的回復代碼是:- 451 寫入本地文件失敗. 這是什么意思.

Now the reply code i recieved is :- 451 Failure writing to local file. What does that means.

謝謝

推薦答案

看了一遍又一遍后,我不斷想出不同的東西.

After looking at it over and over I keep coming up with different things.

您確定 InputStream 在您復制流之前正在讀取文件嗎?因為我不確定 FileInputStream 讀取的是啟動時的文件.

Are you sure that the InputStream is reading the file before your copying the stream? Because I'm not sure FileInputStream read's the file on initiation.

這篇關于在 java 中完成 FTP 后創(chuàng)建 0 kb 文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯(lián)網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環(huán)繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 欧美性一级| 国产成人a亚洲精品 | 国产成人精品综合 | 成人性生交大片免费看r链接 | 日韩中文字幕一区二区 | 亚洲国产精品一区二区三区 | 涩涩视频网站在线观看 | 亚洲福利视频网 | 成人免费在线 | 国精产品一区二区三区 | 国产伦精品一区二区三区照片91 | 午夜视频在线播放 | 久久久久久九九九九 | 日本不卡一区 | 国产精品一区三区 | 一级特黄网站 | 久久av一区二区三区 | 精品视频一区二区三区在线观看 | 中文字幕一区在线观看视频 | 精品国产乱码久久久久久久久 | 亚洲电影成人 | 精品一二区 | 欧美激情黄色 | 国产日韩精品一区 | 91影片| 日韩av一区二区在线观看 | 欧美猛交| 久久久久久亚洲精品 | av在线一区二区三区 | 91久久北条麻妃一区二区三区 | 99视频在线免费观看 | 亚洲精品在线看 | 国产精品国产三级国产aⅴ浪潮 | 一区在线观看视频 | 亚洲综合成人网 | 97在线观看 | 综合九九| 欧美视频免费在线观看 | 欧美一级网站 | 五月综合久久 | 国产精品一区二区三区在线 |