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 long` | `LENGTH_UNKNOWN`

  - ### 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.net.URL` | `getLocation()` Returns the remote location this entry caches.
    `long` | `getOriginalContentLength()` Return the length of the original content that was cached.
    `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` | `isCurrent(long lastModified)` Returns whether there is a version of the URL contents in the cache and it is up to date.
    `protected boolean` | `isHeldByCurrentThread()`
    `protected void` | `lock()` Lock cache item.
    `void` | `markForDelete()` Mark this entry for deletion at shutdown.
    `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` | `setOriginalContentLength(long contentLength)` Set the length of the original content that was cached.
    `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

    - #### LENGTH_UNKNOWN

          public static final long LENGTH_UNKNOWN

      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)

    - #### getOriginalContentLength

          public long getOriginalContentLength()

      Return the length of the original content that was cached. May be different from the actual cache entry size due to (de)compression.
      Returns:
        the content length or `LENGTH_UNKNOWN` if unknown.

    - #### setOriginalContentLength

          public void setOriginalContentLength(long contentLength)

      Set the length of the original content that was cached. May be different from the actual cache entry size due to (de)compression.
      Parameters:
        `contentLength` - length of content

    - #### 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

    - #### 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

    - #### 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()

Submit a bug or feature