XAR extraction

Overview

Xar is popular Mac OS archiving format. You can extract such an archive with Aspose.Zip similarly as other archives.

Aspose.Zip can extract XAR entries compressed with gzip, bzip2, lzma.

Extract an Entry

Following sample extracts entries of the archive one by one.

1try (XarArchive archive = new XarArchive("data.xar")) {
2    for (XarEntry entry : archive.getEntries()) {
3        if (entry instanceof XarFileEntry) {
4            XarFileEntry xarFileEntry = (XarFileEntry) entry;
5            xarFileEntry.extract("extracted/" + entry.getFullPath());
6        }
7    }
8}

Extract Whole Arcive

Following sample extracts all content to the directory.

1try (XarArchive archive = new XarArchive("data.xar")) {
2    archive.extractToDirectory("data");
3}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.