es.prodevelop.gvsig.mobile.fmap.util.download
Class Downloader

java.lang.Object
  extended byes.prodevelop.gvsig.mobile.fmap.util.download.Downloader

public class Downloader
extends java.lang.Object

Utility class to download resources from the internet.

Author:
jldominguez
See Also:
DownloadTask, DownloadException

Field Summary
static java.lang.String CACHED_FILES_ROOT_PATH
           
 
Constructor Summary
Downloader()
           
 
Method Summary
static java.lang.Object downloadObjectCancel(java.net.URL u, java.lang.String exte, int type, java.lang.String cachedFilesSubfolder, java.lang.String filePath, boolean use_hash)
          This method downloads the resource into a local File or as an array of bytes in memory.
static byte[] getByteArray(java.net.URL u, java.lang.String exte)
          This method downloads a URL as a byte array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHED_FILES_ROOT_PATH

public static java.lang.String CACHED_FILES_ROOT_PATH
Constructor Detail

Downloader

public Downloader()
Method Detail

downloadObjectCancel

public static java.lang.Object downloadObjectCancel(java.net.URL u,
                                                    java.lang.String exte,
                                                    int type,
                                                    java.lang.String cachedFilesSubfolder,
                                                    java.lang.String filePath,
                                                    boolean use_hash)
                                             throws DownloadException
This method downloads the resource into a local File or as an array of bytes in memory.

Parameters:
u - the URL
exte - the extension (used if it's going to be a file)
type - download type (file/array)
cachedFilesSubfolder - folder destination (used when it's a file)
filePath - file path on the folder destination
use_hash - whether a hash funcrtion must be used to code the file name
Returns:
an object file or an array of bytes
Throws:
DownloadException

getByteArray

public static byte[] getByteArray(java.net.URL u,
                                  java.lang.String exte)
                           throws DownloadException
This method downloads a URL as a byte array. It does no participate in the file cache, so should be avoided

Parameters:
u -
exte -
Returns:
the resource as a bute array
Throws:
DownloadException