文本文件被FTPClient截断

时间:2016-08-26 13:12:53

标签: java android android-7.0-nougat

我正在开发一个Android应用程序,其中我使用Apache Commons Net库的FTPClient对象从FTP服务器连接和下载文件,但是当我下载文件时在Android Nougat上,它被截断了一半。该应用程序在Marshmallow运行良好。 有人可以帮帮我吗? 这是适用于Marshmallow的代码:

    File app = new File(local_filename);
    FTPClient client = new FTPClient();
    client.connect(ip,port);
    client.login(username,password);
    client.setFileType(FTP.ASCII_FILE_TYPE);
    client.setFileTransferMode(FTP.BLOCK_TRANSFER_MODE);
    client.enterLocalPassiveMode();
    BufferedOutputStream buffOut = new BufferedOutputStream(new FileOutputStream(app));
    client.retrieveFile(filename,buffOut);

    buffOut.flush();
    buffOut.close();

抱歉英语不好。

感谢。

0 个答案:

没有答案