|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcz.hdf.cdnavigator.Cache
public class Cache
Cache files in another thread. You can easy put files into cache
without waiting cacheFile() or wait for finishing
cacheFileDirectly().
Right CD medium must be mounted in mount dir.
| Nested Class Summary | |
|---|---|
private class |
Cache.Cacher
Cache/copy files into cache directory. |
private class |
Cache.Updater
Go through cache directory and update timeFileSizes
structure. |
| Field Summary | |
|---|---|
private java.io.File |
cacheDir
cache directory |
private Cache.Cacher |
cacher
thread to copy files |
private java.util.ArrayList<CacheFileRecord> |
filesToCache
new files to copy in cache |
private java.util.logging.Logger |
logger
Logger. |
private boolean |
run
cacher will run until this is true |
private long |
size
cache size, size of all files in bytes |
private java.util.SortedMap<java.lang.Long,java.lang.Long> |
timeFileSizes
files already in cache. key = time, value = size of all files with this time |
private Cache.Updater |
updater
thread to update cache structure |
| Constructor Summary | |
|---|---|
Cache()
Initialize cache and sorted list of cache files. |
|
| Method Summary | |
|---|---|
static java.lang.String |
buildCacheFolderName(java.lang.String _hashcode)
Build/Create folder name for caching CDs. |
void |
cacheFile(CDData _cd,
java.lang.String _relFile)
Add file to cache. if file already exists - his time is updated, else copy file to cache. |
void |
cacheFileDirectly(CDData _cd,
java.lang.String _relFile)
Add file to cache. if file already exists - his time is updated, else copy file to cache. |
void |
changeCacheDir(java.lang.String _newDirectory)
call when user set new cache directory. |
void |
clearDirectory(java.io.File _file,
java.lang.Long _timeToDelete,
boolean _deleteRoot)
DOCUMENT ME! |
void |
stop()
stop cacher. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.SortedMap<java.lang.Long,java.lang.Long> timeFileSizes
private java.util.ArrayList<CacheFileRecord> filesToCache
private Cache.Cacher cacher
private Cache.Updater updater
private java.io.File cacheDir
private boolean run
private long size
private java.util.logging.Logger logger
| Constructor Detail |
|---|
public Cache()
| Method Detail |
|---|
public void cacheFile(CDData _cd,
java.lang.String _relFile)
_cd - CD data of file to cache_relFile - file to cache
public void cacheFileDirectly(CDData _cd,
java.lang.String _relFile)
_cd - CD of file to cache_relFile - file to cachepublic void changeCacheDir(java.lang.String _newDirectory)
_newDirectory - new cache directory
public void clearDirectory(java.io.File _file,
java.lang.Long _timeToDelete,
boolean _deleteRoot)
_file - _timeToDelete - _deleteRoot - delete root empty folder?public void stop()
public static java.lang.String buildCacheFolderName(java.lang.String _hashcode)
_hashcode -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||