org.apache.tools.ant.taskdefs.Untar Java Examples
The following examples show how to use
org.apache.tools.ant.taskdefs.Untar.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AntDecorator.java From oodt with Apache License 2.0 | 5 votes |
public static void untarFile(File tarFile, File destDir) throws IOException { Untarer untar = new Untarer(); Untar.UntarCompressionMethod compMethod = new UntarCompressionMethod(); compMethod.setValue("gzip"); untar.setCompression(compMethod); untar.setDest(destDir); untar.setSrc(tarFile); untar.execute(); // now that the work is done, use file utils to // move everything out of destDir/tarFileNoExt // into destDir // then delete destDir/tarFileNoExt String wrongInstallDir = destDir.getCanonicalPath() + File.separator + getFileNameNoExt(tarFile.getName()); FileUtils.copyDirectory(new File(wrongInstallDir), destDir, true); // grrr java IO, love it // because it sucks, we have to CHMOD everything in destDir/bin File binDir = new File(destDir.getCanonicalPath() + File.separator + "bin"); Chmoder chmod = new Chmoder(); chmod.setDir(binDir); chmod.setPerm("ugo+rx"); chmod.setIncludes("*"); chmod.execute(); deleteAllFilesAndDir(new File(wrongInstallDir)); }