zeroslackr.installer
Class Tools

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

public abstract class Tools
extends java.lang.Object

Abstract Tools class

Collection of useful methods.

Licensed under GNU GPL (Version 3).

Version:
1.0 Dec 21, 2007
Author:
Keripo

Constructor Summary
Tools()
           
 
Method Summary
static java.lang.String convertPath(java.lang.String path)
          Converts processed path to native equivalent.
static boolean extract(java.lang.String file, java.lang.String dest)
          Extracts an archive to a specified location.
static java.lang.String getMd5(java.lang.String file)
          Calculates the Md5 hash of a target file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tools

public Tools()
Method Detail

convertPath

public static java.lang.String convertPath(java.lang.String path)
Converts processed path to native equivalent.

Parameters:
path - String of path to be converted.
Returns:
String of converted path.

extract

public static boolean extract(java.lang.String file,
                              java.lang.String dest)
Extracts an archive to a specified location.
Supported file extensions: .gz, .tar.gz
ie extract("linux.bin.gz", "/bin");
or extract ("pz2modules.tar.gz", "/usr/lib/");

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

getMd5

public static java.lang.String getMd5(java.lang.String file)
                               throws java.io.FileNotFoundException,
                                      java.io.IOException
Calculates the Md5 hash of a target file

Parameters:
file - String of path to file.
Returns:
String of Md5 hash.
Throws:
java.io.FileNotFoundException
java.io.IOException