zeroslackr.installer
Class Downloader

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

public abstract class Downloader
extends Object

Abstract Downloader Class.

Methods for downloading files.

Licensed under GNU GPL (Version 3).

Sources: Java's URL class API

Version:
Jan 18, 2008
Author:
Keripo

Constructor Summary
Downloader()
           
 
Method Summary
static void download(String url, String dest)
          Download a file to a location.
static String getBaseName(String file)
          Get the basename of a file (ie without the extension).
static String getFileName(String url)
          Get file name in URL.
static String getMd5(String file)
          Calculates the Md5 hash of a target file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Downloader

public Downloader()
Method Detail

download

public static void download(String url,
                            String dest)
                     throws MalformedURLException,
                            IOException
Download a file to a location.

Parameters:
url - String representing URL to download from.
dest - Destination to download to.
Throws:
MalformedURLException
IOException

getFileName

public static String getFileName(String url)
Get file name in URL.

Parameters:
url - String representing URL to check.
Returns:
Name of file.

getBaseName

public static String getBaseName(String file)
Get the basename of a file (ie without the extension).

Parameters:
file - String representing URL to check.
Returns:
Basename of file.

getMd5

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

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