com.duowan.mobile.netroid.cache
Class DiskCache.CacheHeader

java.lang.Object
  extended by com.duowan.mobile.netroid.cache.DiskCache.CacheHeader
Enclosing class:
DiskCache

static class DiskCache.CacheHeader
extends java.lang.Object

Handles holding onto the cache headers for an entry.


Field Summary
 java.lang.String charset
          Charset for cache entry.
 long expireTime
          Expire time for cache entry.
 java.lang.String key
          The key that identifies the cache entry.
 long size
          The size of the data identified by this CacheHeader.
 
Constructor Summary
DiskCache.CacheHeader(java.lang.String key, DiskCache.Entry entry)
          Instantiates a new CacheHeader object
 
Method Summary
 boolean isExpired()
          True if the entry is expired.
static DiskCache.CacheHeader readHeader(java.io.InputStream is)
          Reads the header off of an InputStream and returns a CacheHeader object.
 DiskCache.Entry toCacheEntry(byte[] data)
          Creates a cache entry for the specified data.
 boolean writeHeader(java.io.OutputStream os)
          Writes the contents of this CacheHeader to the specified OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

public long size
The size of the data identified by this CacheHeader. (This is not serialized to disk.


key

public java.lang.String key
The key that identifies the cache entry.


expireTime

public long expireTime
Expire time for cache entry.


charset

public java.lang.String charset
Charset for cache entry.

Constructor Detail

DiskCache.CacheHeader

public DiskCache.CacheHeader(java.lang.String key,
                             DiskCache.Entry entry)
Instantiates a new CacheHeader object

Parameters:
key - The key that identifies the cache entry
entry - The cache entry.
Method Detail

readHeader

public static DiskCache.CacheHeader readHeader(java.io.InputStream is)
                                        throws java.io.IOException
Reads the header off of an InputStream and returns a CacheHeader object.

Parameters:
is - The InputStream to read from.
Throws:
java.io.IOException

toCacheEntry

public DiskCache.Entry toCacheEntry(byte[] data)
Creates a cache entry for the specified data.


isExpired

public boolean isExpired()
True if the entry is expired.


writeHeader

public boolean writeHeader(java.io.OutputStream os)
Writes the contents of this CacheHeader to the specified OutputStream.