try {
// Output file stream
FileOutputStream dest = new FileOutputStream(targetFolderStr + "inputs.tar");
// Create a TarOutputStream
TarOutputStream out = new TarOutputStream(new BufferedOutputStream(dest));
// Files to tar
for (File f : content) {
try {
out.putNextEntry(new TarEntry(f, f.getName()));
BufferedInputStream origin = new BufferedInputStream(new FileInputStream(f));
int count;
byte data[] = new byte[2048];
while ((count = origin.read(data)) != -1) {
out.write(data, 0, count);
}
out.flush();
origin.close();
} catch (IOException ex) {
Logger.getLogger(CompressUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
out.close();
return new File(targetFolderStr + "inputs.tar");
} catch (IOException ex) {
logger.warn(ex.getLocalizedMessage());
}