Package com.mckoi.util
Class LogWriter
- java.lang.Object
-
- java.io.Writer
-
- com.mckoi.util.LogWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class LogWriter extends java.io.WriterA Writer that writes information to a log file that archives old log entries when it goes above a certain size.- Author:
- Tobias Downer
-
-
Constructor Summary
Constructors Constructor Description LogWriter(java.io.File base_name, long max_size, int archive_count)Constructs the log writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidwrite(char[] cbuf, int off, int len)voidwrite(int c)voidwrite(java.lang.String str, int off, int len)
-
-
-
Constructor Detail
-
LogWriter
public LogWriter(java.io.File base_name, long max_size, int archive_count) throws java.io.IOExceptionConstructs the log writer. The 'base_name' is the name of log file. 'max_size' is the maximum size the file can grow to before it is copied to a log archive.- Throws:
java.io.IOException
-
-
Method Detail
-
write
public void write(int c) throws java.io.IOException- Overrides:
writein classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(char[] cbuf, int off, int len) throws java.io.IOException- Specified by:
writein classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(java.lang.String str, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.Writer- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Specified by:
flushin classjava.io.Writer- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Writer- Throws:
java.io.IOException
-
-