writer
Class DeadAIMWriter

java.lang.Object
  extended by writer.DeadAIMWriter
All Implemented Interfaces:
Writer

public class DeadAIMWriter
extends java.lang.Object
implements Writer

Writes files in the DeadAIM format. The file's name is determined by the date. This format is in HTML.


Constructor Summary
DeadAIMWriter(java.lang.String name)
          Initializes a new DeadAIMWriter object.
 
Method Summary
 void addSession(Session session)
          Adds a session to the file accessed via the filewriter.
 boolean closeFile()
          Finishes up writing the file, adds ending tags, and closes the stream.
static java.lang.String fileName(Session session)
          Computes what the filename of log generated at the given date would be.
static void main(java.lang.String[] args)
          Used only to test this class.
 void makeFile(java.lang.String dir, Session session)
          Creates a new log file with the given Session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeadAIMWriter

public DeadAIMWriter(java.lang.String name)
Initializes a new DeadAIMWriter object.

Parameters:
name - Name of "my screen name" in this conversation.
Method Detail

fileName

public static java.lang.String fileName(Session session)
Computes what the filename of log generated at the given date would be.

Parameters:
session - The Session associated with this file.
Returns:
The name of the file.

makeFile

public void makeFile(java.lang.String dir,
                     Session session)

Creates a new log file with the given Session. This function creates a new file with the name appropriate to the Date the Session took place. It then adds the Session to the created file.

If an I/O error occurs while adding the file, this method prints out an error message and returns without finishing the operation.

Specified by:
makeFile in interface Writer
Parameters:
dir - Name of the containing directory.
session - Data to store in the file.

addSession

public void addSession(Session session)
Adds a session to the file accessed via the filewriter.

Parameters:
session - The Session to write to the file.
Throws:
java.lang.IllegalArgumentException - if the date passed in represents a time different the date already associated with the Session.

closeFile

public boolean closeFile()
Finishes up writing the file, adds ending tags, and closes the stream.

Returns:
true if the file was successfully closed. false otherwise.

main

public static void main(java.lang.String[] args)
Used only to test this class.

Parameters:
args - Command-line arguments.