zeroslackr.installer
Class Extractor

java.lang.Object
  extended by zeroslackr.installer.Extractor

public abstract class Extractor
extends Object

Abstract Extractor Class.

Methods for extracting archives.

Licensed under GNU GPL (Version 3).

Sources: SDN "Compressing and Decompressing Data using Java", ICE Engineering's tar package API, Jigsaw's Md5 class API

Version:
Jan 18, 2008
Author:
Keripo

Constructor Summary
Extractor()
           
 
Method Summary
static boolean extract(String file, String dest)
          Extracts an archive to a specified location.
private static void extractGz(String file, String dest)
          Extracts .gz archives.
private static void extractTarGz(String file, String dest)
          Extracts .tar.gz archives.
private static void extractZip(String file, String dest)
          Extracts .zip archives.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Extractor

public Extractor()
Method Detail

extract

public static boolean extract(String file,
                              String dest)
                       throws IOException
Extracts an archive to a specified location. Supported file extensions: .gz, .tar.gz, .zip
ie extract("kernel.gz", "/boot/linux.bin");
or extract("pz2modules.tar.gz", "/usr/lib");
or extract("idoom.zip", "/opt");

Parameters:
file - String of file location.
dest - String of destination folder/file.
Returns:
True if successful, false otherwise.
Throws:
IOException

extractZip

private static void extractZip(String file,
                               String dest)
                        throws IOException
Extracts .zip archives.

Throws:
IOException
See Also:
extract(String file, String dest)

extractGz

private static void extractGz(String file,
                              String dest)
                       throws IOException
Extracts .gz archives.

Throws:
IOException
See Also:
extract(String file, String dest)

extractTarGz

private static void extractTarGz(String file,
                                 String dest)
                          throws IOException
Extracts .tar.gz archives.

Throws:
IOException
See Also:
extract(String file, String dest)