nan.tools
Class BackgroundCacheWriter

java.lang.Object
  extended byjava.lang.Thread
      extended bynan.tools.AbstractBackgroundTask
          extended bynan.tools.BackgroundCacheWriter
All Implemented Interfaces:
BackgroundTask, java.lang.Runnable

public class BackgroundCacheWriter
extends AbstractBackgroundTask

Writes a message cache to disk in the background.

Version:
1.22, 1/6/04
Author:
John David Ratliff

Field Summary
 
Fields inherited from class nan.tools.AbstractBackgroundTask
finished
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BackgroundCacheWriter(Newsgroup newsgroup, MessageTree tree)
          Creates a new BackgroundCacheWriter object.
 
Method Summary
static java.io.File getCacheDirectory(Newsgroup newsgroup)
          Gets the cache directory for a Newsgroup.
static java.io.File getCacheFile(Newsgroup newsgroup, MessageHeader header)
          Gets the cache file for a Newsgroup Message.
static java.io.File getGroupFile(Newsgroup newsgroup)
          Gets the group cache file.
 void run()
          Runs the background task.
 java.lang.String toString()
          Returns a String representation of this object.
static void writeCacheFile(Newsgroup newsgroup, XMLSerializable xml, MessageHeader header)
          Writes a message to the cache.
 
Methods inherited from class nan.tools.AbstractBackgroundTask
isFinished
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BackgroundCacheWriter

public BackgroundCacheWriter(Newsgroup newsgroup,
                             MessageTree tree)
Creates a new BackgroundCacheWriter object.

Parameters:
newsgroup - The Newsgroup to cache.
tree - The MessageTree with the messages.
Method Detail

getCacheDirectory

public static java.io.File getCacheDirectory(Newsgroup newsgroup)
Gets the cache directory for a Newsgroup.

Parameters:
newsgroup - The Newsgroup.
Returns:
The cache directory File.

getCacheFile

public static java.io.File getCacheFile(Newsgroup newsgroup,
                                        MessageHeader header)
Gets the cache file for a Newsgroup Message.

Parameters:
newsgroup - The Newsgroup.
header - The MessageHeader of the Message.
Returns:
The cache File.

getGroupFile

public static java.io.File getGroupFile(Newsgroup newsgroup)
Gets the group cache file.

Parameters:
newsgroup - The newsgroup.
Returns:
The group cache file.

writeCacheFile

public static void writeCacheFile(Newsgroup newsgroup,
                                  XMLSerializable xml,
                                  MessageHeader header)
Writes a message to the cache.

Parameters:
newsgroup - The Newsgroup.
xml - The XMLSerializable object.
header - The MessageHeader of this cache file.

run

public void run()
Runs the background task.


toString

public java.lang.String toString()
Returns a String representation of this object.

Returns:
A String representation.