com.townleyenterprises.trace
Class FileTraceStream

java.lang.Object
  extended bycom.townleyenterprises.trace.FileTraceStream
All Implemented Interfaces:
TraceStream

public class FileTraceStream
extends java.lang.Object
implements TraceStream

This class provides an implementation of the TraceStream interface in terms of a system file.

Since:
3.0
Version:
$Id: FileTraceStream.java,v 1.1 2004/11/27 17:32:50 atownley Exp $
Author:
Andrew S. Townley

Constructor Summary
FileTraceStream(java.lang.String filename, boolean append)
          The constructor takes the name of the file and the append mode for the output stream.
 
Method Summary
 void close()
          This method closes the trace stream.
 java.io.PrintStream getPrintStream()
          This method returns the print stream associated with this output.
 void print(java.lang.Object message)
          This method writes the message to the trace output, but doesn't include the newline.
 void println(java.lang.Object message)
          This method writes a line to the trace output.
 void printStackTrace(java.lang.Throwable ex)
          This method is used to write an exception's stack trace to the trace output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTraceStream

public FileTraceStream(java.lang.String filename,
                       boolean append)
                throws java.io.IOException
The constructor takes the name of the file and the append mode for the output stream.

Parameters:
filename - the name of the file
append - true to append; false to overwrite
Throws:
java.io.IOException - if there was a problem creating the file
Method Detail

print

public void print(java.lang.Object message)
This method writes the message to the trace output, but doesn't include the newline.

Specified by:
print in interface TraceStream
Parameters:
message - the message to write

println

public void println(java.lang.Object message)
This method writes a line to the trace output.

Specified by:
println in interface TraceStream
Parameters:
message - the message to write

printStackTrace

public void printStackTrace(java.lang.Throwable ex)
This method is used to write an exception's stack trace to the trace output.

Specified by:
printStackTrace in interface TraceStream
Parameters:
ex - the exception to print

getPrintStream

public java.io.PrintStream getPrintStream()
This method returns the print stream associated with this output.

Specified by:
getPrintStream in interface TraceStream
Returns:
a PrintStream instance

close

public void close()
This method closes the trace stream.

Specified by:
close in interface TraceStream


Copyright © 2002-2004, Andrew S. Townley and Townley Enterprises. All Rights Reserved.
This project is hosted on http://te-code.sourceforge.net.