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

java.lang.Object
  extended byes.prodevelop.gvsig.mobile.fmap.util.download.DownloadTask
All Implemented Interfaces:
java.lang.Runnable

public class DownloadTask
extends java.lang.Object
implements java.lang.Runnable

This class is used to download resources in a separate thread, so it can be cancelled.

Author:
jldominguez
See Also:
Downloader

Field Summary
static int BYTE_ARRAY
           
static int FILE
           
 
Constructor Summary
DownloadTask(java.net.URL u, java.lang.String exte, int _type, java.io.File dest_file)
          Constructor
 
Method Summary
 void cancel()
          Switches the state to cancelled, so the download should be cancelled
 java.lang.Object getDownloadedObject()
           
 boolean isDone()
           
 void run()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BYTE_ARRAY

public static final int BYTE_ARRAY
See Also:
Constant Field Values

FILE

public static final int FILE
See Also:
Constant Field Values
Constructor Detail

DownloadTask

public DownloadTask(java.net.URL u,
                    java.lang.String exte,
                    int _type,
                    java.io.File dest_file)
Constructor

Parameters:
u - the URL
exte - the local file extension
_type - whether it is a file download or an array of bytes
dest_file - destination file
Method Detail

isDone

public boolean isDone()
Returns:
whether the download is finished

cancel

public void cancel()
Switches the state to cancelled, so the download should be cancelled


run

public void run()
Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

getDownloadedObject

public java.lang.Object getDownloadedObject()
Returns:
the result object (file or byte array)