|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vwp.net.DownloadCacheManager
public class DownloadCacheManager
This class handles the download of data (in background) the storage of these data on disk or - if they have been already downloaded - fetching these data from the local cache on disk.
| Field Summary | |
|---|---|
static int |
BLOCKING
specifies that data don't have to be downloaded in background; in this case the appropriate method blocks until donwload was completed or an error occured |
static int |
CUSTOMDATA
specifies that the downloaded file is a custom file where its input stream has to be applied to a PlayThread class after downloading |
static int |
SOUNDSTREAM
specifies that the downloaded file is a soundfile which has to be applied to a soundnode after downloading |
static int |
TEXTURE
specifies that the downloaded file is a texture and shall be applied to a Shape3D object after downloading |
static int |
VOLATILE
specifies that the downloaded file don't has to be stored at the local disk cache |
| Constructor Summary | |
|---|---|
DownloadCacheManager()
Public constructor: creates a new DownloadCacheManager object with a default location "cache/" of the directory which contains the cached data |
|
DownloadCacheManager(String CacheIndexDir)
Public constructor: creates a new DownloadCacheManager object with a non-default location and/or name of the directory which contains the cached data |
|
DownloadCacheManager(String CacheIndexDir,
String UserAgent,
String Referer)
Public constructor: creates a new DownloadCacheManager object with a non-default location and/or name of the directory which contains the cached data |
|
| Method Summary | |
|---|---|
byte[] |
getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode)
Public interface to start loading or downloading a file from cache or network. |
byte[] |
getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean useFileNameHash)
Public interface to start loading or downloading a file from cache or network. |
byte[] |
getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean peekForFile,
boolean useFileNameHash)
Public interface to start loading or downloading a file from cache or network. |
byte[] |
getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean peekForFile,
boolean useFileNameHash,
Insets cropImage)
Public interface to start loading or downloading a file from cache or network. |
byte[] |
getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean peekForFile,
boolean useFileNameHash,
int numRetries,
int minDlSize)
Public interface to start loading or downloading a file from cache or network. |
byte[] |
getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean useFileNameHash,
int numRetries,
int minDlSize)
Public interface to start loading or downloading a file from cache or network. |
byte[] |
getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
int numRetries,
int minDlSize)
Public interface to start loading or downloading a file from cache or network. |
byte[] |
getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
Object BGObj1,
Object BGObj2,
Object BGObj3,
double scaleImage,
int Quality,
boolean useFileNameHash)
Public interface for specific background downloads. |
byte[] |
getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
Object BGObj1,
Object BGObj2,
Object BGObj3,
double scaleImage,
int Quality,
boolean useFileNameHash,
Insets cropTexture)
Public interface for specific background downloads. |
byte[] |
getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
Object BGObj1,
Object BGObj2,
Object BGObj3,
double scaleImage,
int Quality,
boolean useFileNameHash,
Insets cropTexture,
int numRetries,
int minDlSize)
Public interface for specific background downloads. |
byte[] |
getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
Object BGObj1,
Object BGObj2,
Object BGObj3,
double scaleImage,
int Quality,
boolean useFileNameHash,
int numRetries,
int minDlSize)
Public interface for specific background downloads. |
String |
getFileName(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean useFileNameHash)
Public interface to start loading or downloading a file from cache or network. |
InputStream |
getFileStream(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean peekForFile,
boolean useFileNameHash)
Public interface to start loading or downloading a file from cache or network. |
InputStream |
getFileStream(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
Object BGObj1,
Object BGObj2,
Object BGObj3,
boolean useFileNameHash)
Public interface for specific background downloads. |
void |
removeFile(String FileURL,
boolean useFileNameHash)
This method removes a file from the cache Input: FileURL - the complete URL (not URL object) of the file which has to be (down)loaded DownloadMode - the mode of the download specifies if it has to be loaded in background or directly |
void |
setCacheDir(String CacheIndexDir)
Changes the location and/or the name of the directory which contains the cached data and the cache index file |
void |
setStorageEncryptionKey(int[] EncryptionKey)
Sets a new encryption key which is used for a simple XOR-en/decryption of the stored data so that nobody is able to read the data in the cache. |
void |
setURLInformation(String UserAgent,
String Referer)
Specifies the data which have to be sent to the server the DownloadCache connects with. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int BLOCKING
public static final int VOLATILE
public static final int TEXTURE
public static final int SOUNDSTREAM
public static final int CUSTOMDATA
| Constructor Detail |
|---|
public DownloadCacheManager(String CacheIndexDir,
String UserAgent,
String Referer)
CacheIndexDir - name of the directory which has to be used to store
the downloaded data intoUserAgent - the user agents nameReferer - the referer URLpublic DownloadCacheManager(String CacheIndexDir)
CacheIndexDir - name of the directory which has to be used to store
the downloaded data intopublic DownloadCacheManager()
| Method Detail |
|---|
public void setURLInformation(String UserAgent,
String Referer)
UserAgent - the user agents nameReferer - the referer URLpublic void setStorageEncryptionKey(int[] EncryptionKey)
EncryptionKey - a int-array which specifies the new key, only the
lower 8 bytes of every array index are used for de/encryptionpublic void setCacheDir(String CacheIndexDir)
CacheIndexDir - name/path of the new directory which has to be used
to ache the data on disk
public byte[] getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
Object BGObj1,
Object BGObj2,
Object BGObj3,
double scaleImage,
int Quality,
boolean useFileNameHash)
MyMsgPipe - a MessagePipe object whci hcan be used to transfer error
information from the DownloadCaches background thread to the
calling threadFileURL - URL from which the specified file has to be loadedDownloadMode -
public byte[] getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
Object BGObj1,
Object BGObj2,
Object BGObj3,
double scaleImage,
int Quality,
boolean useFileNameHash,
int numRetries,
int minDlSize)
MyMsgPipe - a MessagePipe object whci hcan be used to transfer error
information from the DownloadCaches background thread to the
calling threadFileURL - URL from which the specified file has to be loadedDownloadMode - numRetries - specifies how often the loader shall try to download a file
again if it fails. If 0 is given here it will be tried t oaccess the
file once and if this fails, no mor donwloads are tried. Default for
this value is 0.minDlSize - the minimum size a file must have to be accepted as valid
public byte[] getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
Object BGObj1,
Object BGObj2,
Object BGObj3,
double scaleImage,
int Quality,
boolean useFileNameHash,
Insets cropTexture)
MyMsgPipe - a MessagePipe object which can be used to transfer error
information from the DownloadCaches background thread to the
calling threadFileURL - URL from which the specified file has to be loadedDownloadMode - cropTexture - specifies which part of the texture has to be used
really
public byte[] getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
Object BGObj1,
Object BGObj2,
Object BGObj3,
double scaleImage,
int Quality,
boolean useFileNameHash,
Insets cropTexture,
int numRetries,
int minDlSize)
MyMsgPipe - a MessagePipe object which can be used to transfer error
information from the DownloadCaches background thread to the
calling threadFileURL - URL from which the specified file has to be loadedDownloadMode - cropTexture - specifies which part of the texture has to be used
reallynumRetries - specifies how often the loader shall try to download a file
again if it fails. If 0 is given here it will be tried t oaccess the
file once and if this fails, no mor donwloads are tried. Default for
this value is 0.minDlSize - the minimum size a file must have to be accepted as valid
public String getFileName(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean useFileNameHash)
FileURL - the complete URL (not URL object) of the file which has to
be (down)loadedDownloadMode - the mode of the download specifies if it has to be
loaded in background or directlyuseFileNameHash - use a HasCode instead of a readable FileName
public InputStream getFileStream(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
Object BGObj1,
Object BGObj2,
Object BGObj3,
boolean useFileNameHash)
MyMsgPipe - a MessagePipe object which can be used to transfer error
information from the DownloadCaches background thread to the
calling threadFileURL - URL from which the specified file has to be loadedDownloadMode -
public byte[] getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean useFileNameHash)
public byte[] getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean useFileNameHash,
int numRetries,
int minDlSize)
FileURL - the complete URL (not URL object) of the file which has
to be (down)loadedDownloadMode - the mode of the download specifies if it has to be
loaded in background or directlyuseFileNameHash - use a HasCode instead of a readable FileNamenumRetries - specifies how often the loader shall try to download a file
again if it fails. If 0 is given here it will be tried t oaccess the
file once and if this fails, no mor donwloads are tried. Default for
this value is 0.minDlSize - the minimum size a file must have to be accepted as valid
public byte[] getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode)
public byte[] getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
int numRetries,
int minDlSize)
FileURL - the complete URL (not URL object) of the file which has
to be (down)loadedDownloadMode - the mode of the download specifies if it has to be
loaded in background or directlynumRetries - specifies how often the loader shall try to download a file
again if it fails. If 0 is given here it will be tried t oaccess the
file once and if this fails, no mor donwloads are tried. Default for
this value is 0.minDlSize - the minimum size a file must have to be accepted as valid
public byte[] getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean peekForFile,
boolean useFileNameHash)
public byte[] getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean peekForFile,
boolean useFileNameHash,
int numRetries,
int minDlSize)
FileURL - the complete URL (not URL object) of the file which has
to be (down)loaded
DownloadMode - the mode of the download specifies if it has to be
loaded in background or directlypeekForFile - - is this value is set to true we only look if this file
exists in the cache; this is neccessary e.g. in cases where it is
unknown which special format a file has (.jpg, .gif, .png) and we
do not want to establish a URL-connection for every try when it
already exists in cacheuseFileNameHash - - use a HasCode instead of a readable FileNamenumRetries - specifies how often the loader shall try to download a file
again if it fails. If 0 is given here it will be tried t oaccess the
file once and if this fails, no mor donwloads are tried. Default for
this value is 0.minDlSize - the minimum size a file must have to be accepted as valid
public byte[] getFile(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean peekForFile,
boolean useFileNameHash,
Insets cropImage)
FileURL - the complete URL (not URL object) of the file which has
to be (down)loadedDownloadMode - the mode of the download specifies if it has to be
loaded in background or directlypeekForFile - is this value is set to true we only look if this file
exists in the cache; this is neccessary e.g. in cases where it is
unknown which special format a file has (.jpg, .gif, .png) and we
do not want to establish a URL-connection for every try when it
already exists in cacheuseFileNameHash - use a HasCode instead of a readable FileNamecropImage - specifies if a downloaded texture has to be cropped,
this param can be set to null if no image has to be downloaded or
if the image doesn'T has to be cropped
public InputStream getFileStream(MessagePipe MyMsgPipe,
String FileURL,
int DownloadMode,
boolean peekForFile,
boolean useFileNameHash)
public void removeFile(String FileURL,
boolean useFileNameHash)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||