私はファイルを持っているとしましょうC:\source.dat
。zipファイルに圧縮したいC:\folder\destination.zip
。
簡単な例を見つけることができず、Maven プロジェクトで提供されている HelloWorld は、平文ファイルを作成していないため、私の場合には実際には当てはまりません。誰かがこれについて教えてくれることを願っています。
参考までに、例で提供されているコードは次のとおりです。
@Override
protected int work(String[] args) throws IOException {
// By default, ZIP files use character set IBM437 to encode entry names
// whereas JAR files use UTF-8.
// This can be changed by configuring the respective archive driver,
// see Javadoc for TApplication.setup().
final Writer writer = new TFileWriter(
new TFile("archive.zip/dir/HälloWörld.txt"));
try {
writer.write("Hello world!\n");
} finally {
writer.close();
}
return 0;
}