Created
April 16, 2025 19:53
-
-
Save aspose-com-gists/2753ffd25ea21e1b6e229221dc6596c6 to your computer and use it in GitHub Desktop.
Open XAR Files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class main { | |
public static void main(String[] args) throws FileNotFoundException, java.io.IOException { | |
// Set the path for the working directories. | |
String sourceFile = "/files/sample.xar"; | |
String outDir = "/Desktop/"; | |
// Open a file input stream to read the .xar file located at the given path. | |
try (FileInputStream fis = new FileInputStream(sourceFile)) { | |
// Initialize an instance of the XarArchive class with the input stream. | |
try (XarArchive archive = new XarArchive(fis)) { | |
// Extract all the files in the archive to the directory provided by calling the extractToDirectory method. | |
archive.extractToDirectory(outDir + "DecompressXar_out"); | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment