jautil.avatar
Class AvatarCacheDescriptor

java.lang.Object
  extended by jautil.avatar.AvatarCacheDescriptor

public class AvatarCacheDescriptor
extends java.lang.Object

Descriptor for an entry in the avatar data cache.


Constructor Summary
AvatarCacheDescriptor(java.lang.String av, java.lang.String avurl, java.lang.String cdurl, long tstamp, int len)
           
 
Method Summary
 java.lang.String avatar()
           
 java.lang.String cacheURL()
           
 void clearTempFile()
          Clears the temporary file setting for this descriptor.
 int dataLength()
           
static java.lang.String[] getLines(java.io.InputStream ins)
          Reads and returns the lines from the given input stream.
static AvatarCacheDescriptor makeDescriptor(java.lang.String[] dlines)
          Creates a new descriptor from the given array of data lines.
 boolean matches(AvatarCacheDescriptor acd)
           
 boolean matchesAvatarAndURL(java.lang.String av, java.lang.String aurl)
           
 boolean matchesTimeAndLength(long ts, int len)
          Determines whether or not the time stamp and data length for the original URL described here match the given values.
 boolean matchesURL(java.lang.String avurl)
          Indicates whether the given avatar URL matches the original URL for this descriptor.
static AvatarCacheDescriptor readDescriptor(java.io.InputStream dins)
          Builds and returns a new descriptor based on the data obtained from the given stream, or returns null if there is an input error.
 void setTempFile(java.io.File tmpf)
          Records the given temporary file as the current one for cached avatar data described here.
 java.io.File tempFile()
          Returns the current temporary file setting for this descriptor, or null if there is currently no associated temporary file.
 java.lang.String tempFileURL()
          Returns a file: URL for the temporary file currently set for this descriptor, or null if there is currently no associated temporary file.
 long timeStamp()
           
 java.lang.String url()
           
 void write(java.io.OutputStream outs)
          Writes the essential data for this cache entry (avatar name, original URL, cache data URL, original time stamp, and original data length) to the given output stream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvatarCacheDescriptor

public AvatarCacheDescriptor(java.lang.String av,
                             java.lang.String avurl,
                             java.lang.String cdurl,
                             long tstamp,
                             int len)
Method Detail

avatar

public java.lang.String avatar()

url

public java.lang.String url()

cacheURL

public java.lang.String cacheURL()

timeStamp

public long timeStamp()

dataLength

public int dataLength()

matches

public boolean matches(AvatarCacheDescriptor acd)

matchesAvatarAndURL

public boolean matchesAvatarAndURL(java.lang.String av,
                                   java.lang.String aurl)

matchesURL

public boolean matchesURL(java.lang.String avurl)
Indicates whether the given avatar URL matches the original URL for this descriptor.


matchesTimeAndLength

public boolean matchesTimeAndLength(long ts,
                                    int len)
Determines whether or not the time stamp and data length for the original URL described here match the given values.


setTempFile

public void setTempFile(java.io.File tmpf)
Records the given temporary file as the current one for cached avatar data described here.


clearTempFile

public void clearTempFile()
Clears the temporary file setting for this descriptor.


tempFile

public java.io.File tempFile()
Returns the current temporary file setting for this descriptor, or null if there is currently no associated temporary file.


tempFileURL

public java.lang.String tempFileURL()
Returns a file: URL for the temporary file currently set for this descriptor, or null if there is currently no associated temporary file.


write

public void write(java.io.OutputStream outs)
Writes the essential data for this cache entry (avatar name, original URL, cache data URL, original time stamp, and original data length) to the given output stream


readDescriptor

public static AvatarCacheDescriptor readDescriptor(java.io.InputStream dins)
Builds and returns a new descriptor based on the data obtained from the given stream, or returns null if there is an input error.


makeDescriptor

public static AvatarCacheDescriptor makeDescriptor(java.lang.String[] dlines)
Creates a new descriptor from the given array of data lines.


getLines

public static java.lang.String[] getLines(java.io.InputStream ins)
                                   throws java.io.IOException
Reads and returns the lines from the given input stream.

Throws:
java.io.IOException