IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.base
Class TraceFile

java.lang.Object
  extended by com.ibm.btt.base.TraceFile

 class TraceFile
extends java.lang.Object

This class is implemented to write the trace lines to a disk file. There is a maximum number of lines that can be written into the file, when this number is reached then the file is closed and a new file is opened, until it reaches the maximum number of log files.


Constructor Summary
TraceFile()
          This constructor creates a TraceFile object.
 
Method Summary
protected  void changeFile()
          Changes the name of the log file.
 void close()
          Closes all the streams opened by the trace file.
protected  void createBackup()
          Creates a backup, rename the current log filename to a '.bak' extension.
 void finalize()
          Free all the resources used by the class.
static java.lang.String getEndLine()
          Get the O.S. name in order to return the End Of Line for that O.S.
static int getEndLineLength()
          Returns the width of the end line trailer depending the O.S.
 java.lang.String getFileName()
          Returns the name of the current log file.
protected  int getLinesWritten()
          Returns the number of lines written in the current log file.
 int getLineWidth()
          Return the width of a line in characters.
 void open()
          Opens the file of trace.
 void reset()
          Resets all the settings & resources used by the class.
 void setLineWidth(int length)
          Sets the width of a line in characters.
 void trace(java.lang.String line)
          Does all the process necesary to write 'line' into a file.
 void trace(java.lang.String line, java.util.Date date)
          Does all the process necesary to write 'line' into a file.
protected static java.lang.String unformatFileName(java.lang.String nameFmt, java.util.Calendar now, int order)
          Returns the unformatted filename using a date and an order.
protected static boolean usesDate(java.lang.String nameFmt)
          Checks if the format uses a date.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraceFile

public TraceFile()
          throws java.lang.Exception
This constructor creates a TraceFile object.

Throws:
java.lang.Exception - - The file can't be created
Method Detail

changeFile

protected void changeFile()
                   throws java.io.IOException
Changes the name of the log file.

Throws:
java.io.IOException - - If it can't change the filename

close

public void close()
Closes all the streams opened by the trace file.


createBackup

protected void createBackup()
Creates a backup, rename the current log filename to a '.bak' extension.


finalize

public void finalize()
              throws java.lang.Throwable
Free all the resources used by the class.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - If can't free the resources.

getEndLine

public static java.lang.String getEndLine()
Get the O.S. name in order to return the End Of Line for that O.S.

Returns:
java.lang.String

getEndLineLength

public static int getEndLineLength()
Returns the width of the end line trailer depending the O.S.

The result is the same as getting the string length result of the getEndLine() method.

Returns:
int

getFileName

public java.lang.String getFileName()
Returns the name of the current log file.

Returns:
java.lang.String

getLinesWritten

protected int getLinesWritten()
Returns the number of lines written in the current log file.

Returns:
int

getLineWidth

public int getLineWidth()
Return the width of a line in characters.

Returns:
int

open

public void open()
Opens the file of trace.


reset

public void reset()
Resets all the settings & resources used by the class.


setLineWidth

public void setLineWidth(int length)
Sets the width of a line in characters.

Parameters:
length - int

trace

public void trace(java.lang.String line)
Does all the process necesary to write 'line' into a file.

Parameters:
line - java.lang.String

trace

public void trace(java.lang.String line,
                  java.util.Date date)
Does all the process necesary to write 'line' into a file.

Parameters:
line - java.lang.String
date - java.util.Date

unformatFileName

protected static java.lang.String unformatFileName(java.lang.String nameFmt,
                                                   java.util.Calendar now,
                                                   int order)
Returns the unformatted filename using a date and an order.

Parameters:
nameFmt - java.lang.String
now - java.util.Calendar
order - int
Returns:
java.lang.String

usesDate

protected static boolean usesDate(java.lang.String nameFmt)
Checks if the format uses a date.

Parameters:
nameFmt - java.lang.String
Returns:
boolean

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2009