All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gnu.inet.tftp.TftpLogStream

java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----gnu.inet.tftp.TftpLogStream

public class TftpLogStream
extends OutputStream
TftpLogStream is a class designed to simultaneously output to stdout and another PrintStream and pad each output with the date and time. Should be buffered by BufferedOutputStream or the included LineBufferedOutputStream to work properly as the date prepending will only work within the write(,,) functions and not write(int).

Version:
0.1
Author:
Mark Benvenuto
See Also:
LineBufferedOutputStream

Constructor Index

 o TftpLogStream()
Constructs a TftpLogStream.

Method Index

 o close()
Does not do anything.
 o flush()
Flushes Buffers of Stdout and Primary
 o getDateFormat()
Gets the string from the internal SimpleDateFormat used when formatting the date
 o getlogPrimary()
Gets logPrimary.
 o getLogStdout()
Gets Stdout.
 o getuseDate()
Gets whether or not we use date handling
 o isLoggingPrimary()
Gets whether or not we print to Primary
 o isLoggingStdout()
Gets whether or not we print to Stdout
 o setDateFormat(String)
Sets the string to use in the internal SimpleDateFormat when formatting the date
 o setLogPrimary(PrintStream)
Sets logPrimary.
 o setuseDate(boolean)
Sets whether or not we use date handling
 o useLogPrimary(boolean)
Sets whether or not we print to Primary
 o useLogStdout(boolean)
Sets whether or not we print to Stdout
 o write(byte[])
Writes bytes to Stdout and Primary if needed.
 o write(byte[], int, int)
Writes bytes to Stdout and Primary if needed.
 o write(int)
Writes a byte to Stdout and Primary if needed.

Constructors

 o TftpLogStream
 public TftpLogStream()
Constructs a TftpLogStream. Initializes date handling and by default does not use it. By default it logs to Stdout.

Methods

 o write
 public void write(int b) throws IOException
Writes a byte to Stdout and Primary if needed. Note: This does not use the date buffering. If you want to use this class properly you Must buffer this OutputStream with BufferedOuputStream.

Parameters:
b - Byte to write to outputstreams
Overrides:
write in class OutputStream
 o write
 public void write(byte b[]) throws IOException
Writes bytes to Stdout and Primary if needed. Calls write(b,0,b.length)

Parameters:
b - Bytes to write to outputstreams
Overrides:
write in class OutputStream
 o write
 public void write(byte b[],
                   int off,
                   int len) throws IOException
Writes bytes to Stdout and Primary if needed. Note: This does use the date buffering.

Parameters:
b - Bytes to write to outputstreams
off - Offset to start at
len - Length of bytes to send to output streams
Overrides:
write in class OutputStream
 o flush
 public void flush() throws IOException
Flushes Buffers of Stdout and Primary

Overrides:
flush in class OutputStream
 o close
 public void close() throws IOException
Does not do anything.

Overrides:
close in class OutputStream
 o setuseDate
 public void setuseDate(boolean b)
Sets whether or not we use date handling

Parameters:
b - true means it uses date, false means no
 o getuseDate
 public boolean getuseDate()
Gets whether or not we use date handling

Returns:
true means it uses date, false means no
 o setDateFormat
 public void setDateFormat(String str)
Sets the string to use in the internal SimpleDateFormat when formatting the date

Parameters:
str - correct string for SimpleDateFormat.applyPattern(str);
 o getDateFormat
 public String getDateFormat()
Gets the string from the internal SimpleDateFormat used when formatting the date

Returns:
s correct string for SimpleDateFormat.toPattern();
 o useLogStdout
 public void useLogStdout(boolean b)
Sets whether or not we print to Stdout

Parameters:
b - true means it uses Stdout, false means no
 o isLoggingStdout
 public boolean isLoggingStdout()
Gets whether or not we print to Stdout

Returns:
true means it uses Stdout, false means no
 o getLogStdout
 public PrintStream getLogStdout()
Gets Stdout. This class uses System.out

Returns:
a PrintStream representing System.out
 o useLogPrimary
 public void useLogPrimary(boolean b)
Sets whether or not we print to Primary

Parameters:
b - true means it uses Primary, false means no
 o isLoggingPrimary
 public boolean isLoggingPrimary()
Gets whether or not we print to Primary

Returns:
true means it uses Primary, false means no
 o setLogPrimary
 public void setLogPrimary(PrintStream os)
Sets logPrimary.

Parameters:
os - a PrintStream to represent logPrimary
 o getlogPrimary
 public PrintStream getlogPrimary()
Gets logPrimary. This must be set before or else null will be returned

Returns:
a PrintStream representing logPrimary

All Packages  Class Hierarchy  This Package  Previous  Next  Index