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
-
TftpLogStream()
- Constructs a TftpLogStream.
-
close()
- Does not do anything.
-
flush()
- Flushes Buffers of Stdout and Primary
-
getDateFormat()
- Gets the string from the internal SimpleDateFormat
used when formatting the date
-
getlogPrimary()
- Gets logPrimary.
-
getLogStdout()
- Gets Stdout.
-
getuseDate()
- Gets whether or not we use date handling
-
isLoggingPrimary()
- Gets whether or not we print to Primary
-
isLoggingStdout()
- Gets whether or not we print to Stdout
-
setDateFormat(String)
- Sets the string to use in the internal SimpleDateFormat
when formatting the date
-
setLogPrimary(PrintStream)
- Sets logPrimary.
-
setuseDate(boolean)
- Sets whether or not we use date handling
-
useLogPrimary(boolean)
- Sets whether or not we print to Primary
-
useLogStdout(boolean)
- Sets whether or not we print to Stdout
-
write(byte[])
- Writes bytes to Stdout and Primary if needed.
-
write(byte[], int, int)
- Writes bytes to Stdout and Primary if needed.
-
write(int)
- Writes a byte to Stdout and Primary if needed.
TftpLogStream
public TftpLogStream()
- Constructs a TftpLogStream. Initializes date handling and by default
does not use it. By default it logs to Stdout.
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
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
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
flush
public void flush() throws IOException
- Flushes Buffers of Stdout and Primary
- Overrides:
- flush in class OutputStream
close
public void close() throws IOException
- Does not do anything.
- Overrides:
- close in class OutputStream
setuseDate
public void setuseDate(boolean b)
- Sets whether or not we use date handling
- Parameters:
- b - true means it uses date, false means no
getuseDate
public boolean getuseDate()
- Gets whether or not we use date handling
- Returns:
- true means it uses date, false means no
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);
getDateFormat
public String getDateFormat()
- Gets the string from the internal SimpleDateFormat
used when formatting the date
- Returns:
- s correct string for SimpleDateFormat.toPattern();
useLogStdout
public void useLogStdout(boolean b)
- Sets whether or not we print to Stdout
- Parameters:
- b - true means it uses Stdout, false means no
isLoggingStdout
public boolean isLoggingStdout()
- Gets whether or not we print to Stdout
- Returns:
- true means it uses Stdout, false means no
getLogStdout
public PrintStream getLogStdout()
- Gets Stdout. This class uses System.out
- Returns:
- a PrintStream representing System.out
useLogPrimary
public void useLogPrimary(boolean b)
- Sets whether or not we print to Primary
- Parameters:
- b - true means it uses Primary, false means no
isLoggingPrimary
public boolean isLoggingPrimary()
- Gets whether or not we print to Primary
- Returns:
- true means it uses Primary, false means no
setLogPrimary
public void setLogPrimary(PrintStream os)
- Sets logPrimary.
- Parameters:
- os - a PrintStream to represent logPrimary
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