久久久久久久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 文件的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我正在嘗試將文件通過 FTP 傳輸?shù)竭h(yuǎn)程計(jì)算機(jī)上.下面是我的代碼:-

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();

當(dāng)我執(zhí)行這段代碼時(shí),代碼執(zhí)行沒有任何問題,但是在遠(yuǎn)程機(jī)器上,當(dāng)我檢查文件時(shí),正在創(chuàng)建文件,但沒有內(nèi)容 (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.

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

[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());

現(xiàn)在我收到的回復(fù)代碼是:- 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 在您復(fù)制流之前正在讀取文件嗎?因?yàn)槲也淮_定 FileInputStream 讀取的是啟動(dòng)時(shí)的文件.

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.

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

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

相關(guā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,如何獲取插入的自動(dòng)生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數(shù)據(jù)庫(kù))
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對(duì)象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 欧美黄色性生活视频 | 国产女人叫床高潮大片免费 | 日韩三级在线观看 | 国产成人一区二区三区 | 国产999精品久久久久久绿帽 | 国产福利在线看 | 九九热精品视频 | 综合久久久久久久 | 精品国产三级 | 91文字幕巨乱亚洲香蕉 | 国产亚洲精品美女久久久久久久久久 | 韩日一区 | 中文字幕在线看第二 | 日韩不卡视频在线观看 | www97影院| 久久久久久久久国产精品 | 美女黄色在线观看 | 国产精品久久久久久久久久久久冷 | 9999在线视频 | 日日操视频| 国产精品视频一区二区三区不卡 | av av在线 | 在线看日韩 | 成年人视频在线免费观看 | 91av在线看 | 国产精品视频播放 | 免费黄色在线 | 久夜精品| 亚洲视频中文字幕 | 不卡av在线 | 久草免费在线视频 | 国产乱码精品一区二区三区忘忧草 | 中文字幕在线一区二区三区 | 亚洲香蕉在线视频 | 亚洲午夜精品视频 | 成人av鲁丝片一区二区小说 | av片免费 | 成年人国产在线观看 | 国产丝袜一区二区三区免费视频 | 亚洲97| 久久精品国产久精国产 |