In an application we use the zip4j library to decompress zip files.
File toBeExtractedFile = new File("valid/path/to/File");
ZipFile zipFile = new ZipFile(toBeExtractedFile);
zipFile.setFileNameCharset(StandardCharsets.UTF_8.name);
zipFile.extractAll("valid/path")
With .zip files this code works perfectly fine. But when done with a .tar file, this wil throw a new ZipException("zip headers not found. probably not a zip file");
Can the zip4j library extract TAR files when given additional info or parameters or do i have to resort to using something else like a TarArchiveInputstream
?
No, ZIP and TAR are two different archive formats. You can use Apache Commons Compress which supports TAR format.