Class CachedFile
- java.lang.Object
-
- net.adoptopenjdk.icedteaweb.resources.cache.CachedFile
-
- All Implemented Interfaces:
ResourceInfo
class CachedFile extends java.lang.Object implements ResourceInfo
Describes an entry in the cache.- Version:
- $Revision: 1.10 $
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.FilecacheFilethe cache file(package private) static java.lang.StringINFO_SUFFIXprivate CacheKeykeyprivate static java.lang.StringKEY_DOWNLOADED_AT(package private) static java.lang.StringKEY_JNLP_PATHprivate static java.lang.StringKEY_LAST_MODIFIEDprivate static java.lang.StringKEY_SIZEprivate static LoggerLOGprivate PropertiesFilepropertiesinfo about the cached file
-
Constructor Summary
Constructors Constructor Description CachedFile(CacheIndexEntry lruEntry, java.io.File cacheFile, java.io.File infoFile)CachedFile(CacheKey key, java.io.File cacheFile, java.io.File infoFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.io.FilegetCacheFile()CacheKeygetCacheKey()longgetDownloadedAt()Returns the time in the local system clock that the file was most recently checked for an update.(package private) java.lang.StringgetJnlpPath()longgetLastModified()private longgetLongKey(java.lang.String key)longgetSize()(package private) booleanisCached()Returns true if the cache has a local copy of the resource.(package private) booleanisCurrent(long lastModified)Returns whether there is a version of the URL contents in the cache and it is up to date.(package private) booleanisFile()private voidsetLongKey(java.lang.String key, long value)(package private) voidstoreInfo(long downloadedAt, long lastModified, long size)java.lang.StringtoString()
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
INFO_SUFFIX
static final java.lang.String INFO_SUFFIX
- See Also:
- Constant Field Values
-
KEY_SIZE
private static final java.lang.String KEY_SIZE
- See Also:
- Constant Field Values
-
KEY_LAST_MODIFIED
private static final java.lang.String KEY_LAST_MODIFIED
- See Also:
- Constant Field Values
-
KEY_DOWNLOADED_AT
private static final java.lang.String KEY_DOWNLOADED_AT
- See Also:
- Constant Field Values
-
KEY_JNLP_PATH
static final java.lang.String KEY_JNLP_PATH
- See Also:
- Constant Field Values
-
key
private final CacheKey key
-
cacheFile
private final java.io.File cacheFile
the cache file
-
properties
private final PropertiesFile properties
info about the cached file
-
-
Constructor Detail
-
CachedFile
CachedFile(CacheIndexEntry lruEntry, java.io.File cacheFile, java.io.File infoFile)
-
CachedFile
CachedFile(CacheKey key, java.io.File cacheFile, java.io.File infoFile)
-
-
Method Detail
-
getCacheKey
public CacheKey getCacheKey()
- Specified by:
getCacheKeyin interfaceResourceInfo- Returns:
- the cache key of the resource
-
getDownloadedAt
public long getDownloadedAt()
Returns the time in the local system clock that the file was most recently checked for an update.- Specified by:
getDownloadedAtin interfaceResourceInfo- Returns:
- when the item was updated (in ms)
-
getSize
public long getSize()
- Specified by:
getSizein interfaceResourceInfo- Returns:
- the size of the resource in bytes
-
getLastModified
public long getLastModified()
- Specified by:
getLastModifiedin interfaceResourceInfo- Returns:
- the last time this resource was modified (in Java millis)
-
getJnlpPath
java.lang.String getJnlpPath()
-
getCacheFile
java.io.File getCacheFile()
-
getLongKey
private long getLongKey(java.lang.String key)
-
setLongKey
private void setLongKey(java.lang.String key, long value)
-
isFile
boolean isFile()
-
isCurrent
boolean isCurrent(long lastModified)
Returns whether there is a version of the URL contents in the cache and it is up to date.- Parameters:
lastModified- - current time as get from server (in ms). Mostly value of "Last-Modified" http header'?- Returns:
- whether the cache contains the version
-
isCached
boolean isCached()
Returns true if the cache has a local copy of the resource.- Returns:
- true if the resource is in the cache
-
storeInfo
void storeInfo(long downloadedAt, long lastModified, long size)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-