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

使用 Apache Commons Net 下載后 FTP 文件損壞

FTP file corrupt after download with Apache Commons Net(使用 Apache Commons Net 下載后 FTP 文件損壞)
本文介紹了使用 Apache Commons Net 下載后 FTP 文件損壞的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問題描述

由此下載的文件,大小幾乎相同,但某些行不同.每個(gè)答案都指向二進(jìn)制文件類型.但這無(wú)濟(jì)于事.有人知道這個(gè)問題(傳輸 PDF)嗎?

The files downloaded by this, are nearly the same size but differ in some lines. Every answer points to binary file type. But this won't help. Got anybody an idea for the problem (transferring PDF)?

FTPClient ftpClient = new FTPClient();
OutputStream outputStream = null;
boolean resultOk = true;

try {
    ftpClient.connect(host, port);
    ftpClient.enterLocalPassiveMode();
    ftpClient.setFileTransferMode(FTP.COMPRESSED_TRANSFER_MODE);
    ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
    if (showMessages) {
        System.out.println(ftpClient.getReplyString());
    }
    resultOk &= ftpClient.login(usr, pwd);
    if (showMessages) {
        System.out.println(ftpClient.getReplyString());
    }

    outputStream = new FileOutputStream(localResultFile);
    resultOk &= ftpClient.retrieveFile(remoteSourceFile, outputStream);
    outputStream.flush();
    outputStream.close();

    if (showMessages) {
        System.out.println(ftpClient.getReplyString());
    }
    if (resultOk == true) {
        resultOk &= ftpClient.deleteFile(remoteSourceFile);
    }

    resultOk &= ftpClient.logout();
    if (showMessages) {
        System.out.println(ftpClient.getReplyString());
    }
} finally {

    ftpClient.disconnect();
}

推薦答案

使用包含空格的非轉(zhuǎn)義路徑時(shí)似乎會(huì)發(fā)生這種情況.例如.C:/Documents and Settings/測(cè)試

It seems to happen when using unescaped paths that contain spaces. E.g. C:/Documents and Settings/test

現(xiàn)在通過對(duì)空格使用轉(zhuǎn)義路徑解決了這個(gè)問題.感謝您的幫助

Got it solved now by using a escaped path for the spaces. Thanks for your help

這篇關(guān)于使用 Apache Commons Net 下載后 FTP 文件損壞的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lá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(使用線程逐塊處理文件)
主站蜘蛛池模板: 免费黄色大片 | 日韩欧美中文 | 四虎影院免费在线播放 | 国产高清在线精品一区二区三区 | 国产美女黄色片 | 日韩视频在线观看一区二区 | 日韩欧美精品一区 | 91影库| 国产成人99久久亚洲综合精品 | 欧美日韩在线视频一区 | 成人亚洲精品久久久久软件 | 特黄级国产片 | 视频在线一区二区 | 国产精品久久久久久婷婷天堂 | 国产在线麻豆精品入口 | 久久精品视频播放 | 免费观看黄色片视频 | 国产精品久久久 | 国产aⅴ爽av久久久久久久 | 亚洲性视频网站 | 99在线播放| 日日干日日色 | 久热伊人 | 日韩精品成人 | 久久99精品国产 | 伊人久操| 在线欧美| 91麻豆精品国产91久久久久久 | 精品视频在线播放 | 国产成人麻豆免费观看 | 韩国av网站在线观看 | 一区二区欧美在线 | 日韩视频中文字幕 | 欧美成人一级 | 日韩精品在线免费 | 久久久国产一区二区三区 | 亚洲一区二区电影网 | 99re在线| 中文字幕日韩三级 | 久久伊 | 一二三四在线视频观看社区 |