public static void main(String[] args) throws IOException { String tar = "H4sIANES52EAA+3RTQrCMBBA4RwlJ9CZND/nEW2hUFBqBY9vgxXEhdpFSsX3bWaRgQy85tgd6n5rSpJRSiFPTUGe54NRr0mjauXUiEoKzthQ9KrJ5TzsemtNfWr37/Y+vf+o5t6/abvab4brUOKPHDhGP6O/C+KNlRLHvPr3/mN4LRV+Mr+/Ohfpv4Tcv1ph/0rov4Tc362wv0v0BwAAAAAAAAAAAADgWzfK+kupACgAAA=="; byte[] content = tar.getBytes(StandardCharsets.UTF_8); TarArchiveInputStream tarIn = new TarArchiveInputStream(new GzipCompressorInputStream(new ByteArrayInputStream(Base64.getDecoder().decode(content)))); try { TarArchiveEntry tarEntry = tarIn.getNextTarEntry(); while (tarEntry != null) { byte[] btoRead = new byte[1024]; ByteArrayOutputStream bout = new ByteArrayOutputStream(); int len = 0; while ((len = tarIn.read(btoRead)) != -1) { bout.write(btoRead, 0, len); } bout.close(); tarEntry = tarIn.getNextTarEntry(); } tarIn.close(); } catch (IOException e) { e.printStackTrace(); } }