|
Purple Code | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.purpletech.io.FileCache
Maintains a cache of files on disk.
| Nested Class Summary | |
protected class |
FileCache.DefaultFetcher
|
static class |
FileCache.Error
|
static interface |
FileCache.Fetcher
|
| Constructor Summary | |
FileCache(java.lang.String dir)
|
|
FileCache(java.lang.String dir,
long msec)
|
|
| Method Summary | |
static void |
debug(java.lang.String x)
|
java.io.File |
get(java.lang.String source)
Takes an http: URL, a file: URL, or a raw file system pathname. |
java.io.File |
get(java.lang.String source,
FileCache.Fetcher fetcher)
|
FileCache.Fetcher |
getDefaultFetcher()
|
FileCache.Error |
getError(java.lang.String source)
|
static boolean |
isDiff(java.io.File a,
java.io.File b)
|
static boolean |
isDiff(java.io.InputStream a,
java.io.InputStream b)
|
static void |
main(java.lang.String[] args)
|
static java.lang.String |
mapName(java.lang.String in)
convert a name to a filesystem-safe name. |
void |
setAllowEmpty(boolean allow)
do we allow empty files to replace non-empty cache files? |
void |
setAllowLocal(boolean allow)
do we allow local file access or just HTTP? |
void |
setCacheDir(java.lang.String dirname)
|
static void |
setDebug(boolean f)
|
void |
setDownloadTimeout(long msec)
number of milliseconds we attempt to download something before failing |
protected void |
setError(java.lang.String source,
java.lang.Throwable exception)
|
void |
setTimeout(long msec)
number of milliseconds we keep something in the cache before refetching |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FileCache(java.lang.String dir)
throws java.io.IOException
public FileCache(java.lang.String dir,
long msec)
throws java.io.IOException
| Method Detail |
public static void setDebug(boolean f)
public void setCacheDir(java.lang.String dirname)
throws java.io.IOException
java.io.IOExceptionpublic void setAllowLocal(boolean allow)
public void setAllowEmpty(boolean allow)
public void setTimeout(long msec)
public void setDownloadTimeout(long msec)
public FileCache.Fetcher getDefaultFetcher()
public java.io.File get(java.lang.String source)
Is not thread-safe. Todo: make a thread-safe Map of currently-downloading files. Compare the source to the contents of that map and block until it's free. Then when it comes out it will check the timestamp and probably notice that it was just downloaded.
public java.io.File get(java.lang.String source,
FileCache.Fetcher fetcher)
public static java.lang.String mapName(java.lang.String in)
public static boolean isDiff(java.io.File a,
java.io.File b)
throws java.io.IOException
java.io.IOException
public static boolean isDiff(java.io.InputStream a,
java.io.InputStream b)
throws java.io.IOException
java.io.IOExceptionpublic static void debug(java.lang.String x)
public FileCache.Error getError(java.lang.String source)
protected void setError(java.lang.String source,
java.lang.Throwable exception)
public static void main(java.lang.String[] args)
throws java.io.IOException
java.io.IOException
|
Documentation generated March 5 2003 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||