/** * Return the uncompressed size for a Tar file. * * @param tarFile The Tarred file * @return Size when uncompressed, in bytes * @throws IOException */ private int getTarSizeUncompressed(File tarFile) throws IOException { int size = 0; TarInputStream tis = new TarInputStream(new BufferedInputStream(new FileInputStream(tarFile))); TarEntry entry; while ((entry = tis.getNextEntry()) != null) { if (!entry.isDirectory()) { size += entry.getSize(); } } return size; }