从 java 中的 FTP 下载 .zip 文件:哪种类型的输出流?

Download .zip file from FTP in java: which type of outputstream?

我写了一个 java 软件连接到 FTP 服务器,并列出了它连接到的目录中的所有可用文件。现在,我想下载 2 个文件。这两个文件都是 .zip 文件,这让我想到了以下问题: 我应该使用什么类型的输出流? FileWriter 更适合 "downloading" 文本文件,对吧? FileOutputStream 是下载档案的最佳方式,还是没有区别?

提前致谢

what type of outputstream should I use?

一个FileOutputStream,或者一个BufferedOutputStream环绕它。

FileWriter is for more adequate for "downloading" textfiles, right?

  • FileWriter 根本不是 OutputStream,而是 Writer。它仅适用于文本数据。

Is FileOutputStream the best way to go when downloading archives

这是下载任何内容的最佳方式。除非您知道数据是文本,在 .zip 文件中肯定不是文本,否则没有理由使用它。

or does it make no difference?

它确实有所作为。