All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.awb.util.LogFileOutputStream

java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----com.ibm.awb.util.LogFileOutputStream

public class LogFileOutputStream
extends OutputStream
Write a log to a file. If the file does not exist, it will create it. If a directory of the file does not exist, ir will create the directory too.


Constructor Index

 o LogFileOutputStream(String, long)
Create an instance of this class.

Method Index

 o close()
Close this.
 o write(byte[])
Write data to the log file.
 o write(byte[], int, int)
Write data to the log file.
 o write(int)
Write data to the log file.

Constructors

 o LogFileOutputStream
 public LogFileOutputStream(String filename,
                            long maxFileSize) throws IOException
Create an instance of this class. If the file does not exist, it will create the file. If a directory of the file does not exist, it will create the directory too.

Parameters:
filename - log file name
maxFileSize - maximum file size of the log. If the size of the log file exceeds this value, the log file will be renamed and a new log file will be created.
Returns:
an instance of this class.
Throws: IOException
if fail to create or access the file.

Methods

 o close
 public void close() throws IOException
Close this.

Overrides:
close in class OutputStream
 o write
 public synchronized void write(byte b[]) throws IOException
Write data to the log file. If the size of the file exceeds maximum size of the file, this stream will rename the file to filename + ".arc" and create a new log file. If the file whose name is "filename + ".arc"" already exists, the existing file will be renamed to "filename + ".arc" + date.getMinutes() + date.getHours() + date.getDate() + date.getMonth() + date.getYear()", where date is current date.

Parameters:
b - data.
Throws: IOException
if fail to write the data.
Overrides:
write in class OutputStream
 o write
 public synchronized void write(byte b[],
                                int off,
                                int len) throws IOException
Write data to the log file. If the size of the file exceeds maximum size of the file, this stream will rename the file to filename + ".arc" and create a new log file. If the file whose name is "filename + ".arc"" already exists, the existing file will be renamed to "filename + ".arc" + date.getMinutes() + date.getHours() + date.getDate() + date.getMonth() + date.getYear()", where date is current date.

Parameters:
b - data.
off - offset of the data.
len - length of the data written to the file.
Throws: IOException
if fail to write the data.
Overrides:
write in class OutputStream
 o write
 public synchronized void write(int b) throws IOException
Write data to the log file. If the size of the file exceeds maximum size of the file, this stream will rename the file to filename + ".arc" and create a new log file. If the file whose name is "filename + ".arc"" already exists, the existing file will be renamed to "filename + ".arc" + date.getMinutes() + date.getHours() + date.getDate() + date.getMonth() + date.getYear()", where date is current date.

Parameters:
b - integer.
Throws: IOException
if fail to write the data.
Overrides:
write in class OutputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index