CacheEntry (IcedTea-Web: NetX )
Keywords: net.sourceforge.jnlp.cache.CacheEntry class
Date: 2021-11-09

net.sourceforge.jnlp.cache

## Class CacheEntry

- java.lang.Object
- - net.sourceforge.jnlp.cache.CacheEntry

-     public class CacheEntry
      extends java.lang.Object

  Describes an entry in the cache.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `KEY_JNLP_PATH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CacheEntry(java.net.URL location, Version version)` Create a CacheEntry for the resources specified as a remote URL.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getLastModified()`
    `long` | `getLastUpdated()` Returns the time in the local system clock that the file was most recently checked for an update.
    `java.io.File` | `getLocalFile()`
    `java.net.URL` | `getLocation()` Returns the remote location this entry caches.
    `long` | `getRemoteContentLength()`
    `boolean` | `isCached()` Returns true if the cache has a local copy of the contents of the URL matching the specified version string.
    `boolean` | `isCached(java.io.File cachedFile)`
    `boolean` | `isCurrent(long lastModified)` Returns whether there is a version of the URL contents in the cache and it is up to date.
    `boolean` | `isCurrent(long lastModified, java.io.File cachedFile)`
    `protected boolean` | `isHeldByCurrentThread()`
    `protected void` | `lock()` Lock cache item.
    `void` | `markForDelete()` Mark this entry for deletion at shutdown.
    `void` | `setJnlpPath(java.lang.String jnlpPath)`
    `void` | `setLastModified(long modifyTime)`
    `void` | `setLastUpdated(long updatedTime)` Sets the time in the local system clock that the file was most recently checked for an update.
    `void` | `setRemoteContentLength(long length)`
    `protected boolean` | `store()` Save the current information for the cache entry.
    `protected boolean` | `tryLock()`
    `protected void` | `unlock()` Unlock cache item.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### KEY_JNLP_PATH

          public static final java.lang.String KEY_JNLP_PATH

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CacheEntry

          public CacheEntry(java.net.URL location,
                            Version version)

      Create a CacheEntry for the resources specified as a remote URL.
      Parameters:
        `location` - the remote resource location
        `version` - the version of the resource

  - ### Method Detail

    - #### getLocation

          public java.net.URL getLocation()

      Returns the remote location this entry caches.
      Returns:
        URL same as the one on which this entry was created

    - #### getLastUpdated

          public long getLastUpdated()

      Returns the time in the local system clock that the file was most recently checked for an update.
      Returns:
        when the item was updated (in ms)

    - #### setLastUpdated

          public void setLastUpdated(long updatedTime)

      Sets the time in the local system clock that the file was most recently checked for an update.
      Parameters:
        `updatedTime` - the time (in ms) to be set as last updated time

    - #### getRemoteContentLength

          public long getRemoteContentLength()

    - #### setRemoteContentLength

          public void setRemoteContentLength(long length)

    - #### setJnlpPath

          public void setJnlpPath(java.lang.String jnlpPath)

    - #### getLastModified

          public long getLastModified()

    - #### setLastModified

          public void setLastModified(long modifyTime)

    - #### isCurrent

          public 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

    - #### isCurrent

          public boolean isCurrent(long lastModified,
                                   java.io.File cachedFile)

    - #### isCached

          public boolean isCached()

      Returns true if the cache has a local copy of the contents of the URL matching the specified version string.
      Returns:
        true if the resource is in the cache

    - #### isCached

          public boolean isCached(java.io.File cachedFile)

    - #### store

          protected boolean store()

      Save the current information for the cache entry.
      Returns:
        True if successfuly stored into file, false otherwise

    - #### markForDelete

          public void markForDelete()

      Mark this entry for deletion at shutdown.

    - #### lock

          protected void lock()

      Lock cache item.

    - #### unlock

          protected void unlock()

      Unlock cache item. Does not do anything if not holding the lock.

    - #### tryLock

          protected boolean tryLock()

    - #### isHeldByCurrentThread

          protected boolean isHeldByCurrentThread()

    - #### getLocalFile

          public java.io.File getLocalFile()

Submit a bug or feature