com.isti.util
Class LogOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.isti.util.LineProcOutputStream
          extended by com.isti.util.LogOutputStream
All Implemented Interfaces:
CallBackStringParam, java.io.Closeable, java.io.Flushable

public class LogOutputStream
extends LineProcOutputStream

Class LogOutputStream defines an output stream that sends data to a LogFile object. 7/1/2003 -- [HS] Initial version. 7/9/2003 -- [ET] Fixed extra-newline added to each line of output; added 'closeLogFile()' and 'setCloseLogFileFlag()' methods; added overridden 'close()' method.


Field Summary
protected  boolean closeLogFileFlag
          Flag set 'true' to close LogFile when this output stream is closed.
protected  int logLevel
          The logging level to use.
protected  LogFile outFile
          The LogFile object to use.
 
Fields inherited from class com.isti.util.LineProcOutputStream
EOL, EOL_LEN, lineBuffer
 
Constructor Summary
LogOutputStream(LogFile logFileObj)
          Creates an output stream that sends data to a LogFile object.
 
Method Summary
 void callBackMethod(java.lang.String s)
          Implements the CallbackStringParam interface.
 void close()
          Overidden version that also flushes any buffered data and closes the LogFile object (if 'closeLogFileFlag' is 'true').
 void closeLogFile()
          Closes the LogFile used by this object.
 LogFile getLogfile()
          Returns a reference to the logfile in use.
 void setCloseLogFileFlag(boolean flgVal)
          Configures whether or not the 'LogFile' object held by this output stream will be closed when the stream is closed.
 void setLoggingLevel(int newLevel)
          Set the logging level used for outputs to the log file.
 
Methods inherited from class com.isti.util.LineProcOutputStream
flush, write
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outFile

protected final LogFile outFile
The LogFile object to use.


logLevel

protected int logLevel
The logging level to use.


closeLogFileFlag

protected boolean closeLogFileFlag
Flag set 'true' to close LogFile when this output stream is closed.

Constructor Detail

LogOutputStream

public LogOutputStream(LogFile logFileObj)
Creates an output stream that sends data to a LogFile object.

Parameters:
logFileObj - the LogFile object to use.
Method Detail

callBackMethod

public void callBackMethod(java.lang.String s)
Implements the CallbackStringParam interface.

Parameters:
s - string parameter to use.

getLogfile

public LogFile getLogfile()
Returns a reference to the logfile in use.

Returns:
the LogFile instance that this instance logs to.

setLoggingLevel

public void setLoggingLevel(int newLevel)
Set the logging level used for outputs to the log file.

Parameters:
newLevel - the new logging level.

setCloseLogFileFlag

public void setCloseLogFileFlag(boolean flgVal)
Configures whether or not the 'LogFile' object held by this output stream will be closed when the stream is closed. The default behavior is for the 'LogFile' object to be closed.

Parameters:
flgVal - true to close the 'LogFile' object when this output stream is closed; false to not.

closeLogFile

public void closeLogFile()
Closes the LogFile used by this object.


close

public void close()
           throws java.io.IOException
Overidden version that also flushes any buffered data and closes the LogFile object (if 'closeLogFileFlag' is 'true').

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException