FTPBlobDownloadStrategy.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:daq-eclipse 作者:
public InputStream getInputStream(ActiveMQBlobMessage message) throws IOException, JMSException {
    url = message.getURL();
    final FTPClient ftp = createFTP();
    String path = url.getPath();
    String workingDir = path.substring(0, path.lastIndexOf("/"));
    String file = path.substring(path.lastIndexOf("/") + 1);
    ftp.changeWorkingDirectory(workingDir);
    ftp.setFileType(FTPClient.BINARY_FILE_TYPE);

    InputStream input = new FilterInputStream(ftp.retrieveFileStream(file)) {

        public void close() throws IOException {
            in.close();
            ftp.quit();
            ftp.disconnect();
        }
    };

    return input;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号