tar アーカイブから単一のファイルを抽出するアプリケーションを作成しました。アプリケーションは *.tar を適切に読み取りますが、ファイルを抽出しようとすると、アプリケーションは正しいファイル名で新しいファイルを作成するだけです... ファイルは空 (0kb) です。だから...おそらく、抽出する代わりに新しいファイルを作成するだけです...
この時点で全くの初心者です...
for(TarArchiveEntry tae : tarEntries){
System.out.println(tarEntries.size());
try {
fOutput = new FileOutputStream(new File(tae.getFile(), tae.getName()));
byte[] buf = new byte[(int) tae.getSize()];
int len;
while ((len = tarFile.read(buf)) > 0) {
fOutput.write(buf, 0, len);
}
fOutput.close();
} catch (IOException e) {
e.printStackTrace();
}
}