
This Java program has two methods deCompressGZipFile() method is used to decompress a. I have used commons-compress-1.13 version. Make sure to add commons-compress-xxx.jar in your application’s class path.
#Untar files code#
Using Apache Commons CompressĪpache Commons Compress library is used in the code for untarring a file.
#Untar files how to#
#Untar files archive#
Options: -c : Creates Archive -x : Extract the archive -f : creates archive with given filename -t : displays or lists files in archived file -u : archives and adds to an existing archive file -v : Displays Verbose Information -A : Concatenates the archive files -z : zip, tells tar command that creates tar. Note: If the first argument is a data stream instead of a file name, then you must specify the DirectoryOut argument. To untar a single tar archive: tar -xf filename.tar. If DirectoryOut is not provided then FILE_UNTAR will untar the archive into File's current directory. This directory will be created if it does not currently exist. Set this optional argument to a scalar string giving the output directory.

IDL will automatically detect if the data stream is also GZIP compressed and uncompress the data first. Instead of a file name, you can set the first argument to a byte array containing the contents of a TAR file. IDL will automatically detect if the file is also GZIP compressed and uncompress the file first. Set this argument to a scalar string giving the file to untar.

SyntaxįILE_UNTAR, File įILE_UNTAR, Data Arguments See FILE_TAR for a different example using the Data argument. map, 1233 bytes Skipped file fonts\tt\ttfont.map % Total 5 files, 11405628 bytes % Time elapsed: 0.035000086 seconds.

IDL prints: % fonts/ Extracted file fonts\ % fonts/hersh1.chr, 97718 bytes Extracted file fonts\hersh1.chr % fonts/ps/ Extracted file fonts\ps\ % fonts/ps/Arimo-Bold.pfa, 123426 bytes Extracted file fonts\ps\Arimo-Bold.pfa % fonts/ps/Arimo-BoldItalic.pfa, 122513 bytes Extracted file fonts\ps\Arimo-BoldItalic.pfa % fonts/ps/Arimo-Italic.pfa, 108377 bytes Skipped file fonts\ps\Arimo-Italic.pfa. Here, we get the list of all files in a ZIP, and extract only the first five files into our current working directory: dir = FILEPATH( '', SUBDIR=) FILE_TAR, dir, 'idlresources.tar' FILE_UNTAR, 'idlresources.tar', /LIST, FILES=files FILE_UNTAR, 'idlresources.tar', EXTRACT_FILES=files, /VERBOSE IDL prints: % fonts/ % fonts/hersh1.chr, 97718 bytes % fonts/tt/ttfont. In the following example, we create a TAR archive of the resource/fonts subdirectory within the IDL installation, and then expand the archive into our current working directory: dir = FILEPATH( '', SUBDIR=) FILE_TAR, dir, 'idlresources.tar' FILE_UNTAR, 'idlresources.tar', /VERBOSE

Instead, the files and directories will have the current file owner and default permissions, and will have a time stamp equal to the current system time. Note: Because of IDL's file I/O limitations, the resulting files and directories will not have any of the original file owner information, permissions (file modes) or time stamps. Its source code can be found in the file file_untar.pro in the lib subdirectory of the IDL distribution. This routine is written in the IDL language. FILE_UNTAR also automatically performs GZIP uncompression if necessary. The FILE_UNTAR procedure uncompresses a TAR file or TAR data stream.
