TarArchiveOutputStream tOut = new TarArchiveOutputStream(
new GzipCompressorOutputStream(new BufferedOutputStream(out)));
for (int i = 0; i < inputFiles.length; i++) {
File f = new File(parentDir, inputFiles[i]);
TarArchiveEntry tarEntry = new TarArchiveEntry(f, f.getName());
tOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
tOut.putArchiveEntry(tarEntry);
FileInputStream input = new FileInputStream(f);
try {
IOUtils.copy(input, tOut); // copy with 8K buffer, not close