com.atomikos.diagnostics
Class PrintStreamConsole

java.lang.Object
  extended by com.atomikos.diagnostics.PrintStreamConsole
All Implemented Interfaces:
Console

public class PrintStreamConsole
extends Object
implements Console

A simple console to a PrintStream.


Field Summary
protected  PrintStream printstream_
           
 
Fields inherited from interface com.atomikos.diagnostics.Console
DEBUG, INFO, WARN
 
Constructor Summary
PrintStreamConsole(PrintStream printstream)
          Constructor.
 
Method Summary
 void close()
          Closes the console after use.
 void finalize()
           
 int getLevel()
          Gets the level of the console.
 void print(String string)
          Print a string to the output, but no newline at the end.
 void print(String string, int level)
          Print a string with a given level of granularity.
 void println(String string)
          Print a message to the output of the console.
 void println(String string, int level)
          Print a string with newline, at a given level of granularity.
 void setLevel(int level)
          Set the overall granularity level of the console.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

printstream_

protected PrintStream printstream_
Constructor Detail

PrintStreamConsole

public PrintStreamConsole(PrintStream printstream)
Constructor.

Parameters:
printstream - The PrintStream to print to.
Method Detail

println

public void println(String string)
             throws IOException
Description copied from interface: Console
Print a message to the output of the console. The level is assumed to be the default (WARN).

Specified by:
println in interface Console
Parameters:
string - The message to output.
Throws:
IOException - On failure.
See Also:
Console

print

public void print(String string)
           throws IOException
Description copied from interface: Console
Print a string to the output, but no newline at the end. The level is assumed to be the default (WARN).

Specified by:
print in interface Console
Parameters:
string - The string to print.
Throws:
IOException - On failure.
See Also:
Console

close

public void close()
           throws IOException
Description copied from interface: Console
Closes the console after use.

Specified by:
close in interface Console
Throws:
IOException - On failure.
See Also:
Console

finalize

public void finalize()
              throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

println

public void println(String string,
                    int level)
             throws IOException
Description copied from interface: Console
Print a string with newline, at a given level of granularity.

Specified by:
println in interface Console
Parameters:
string - The string.
level - The level (one of the predefined constants).
Throws:
IOException - On failure.

print

public void print(String string,
                  int level)
           throws IOException
Description copied from interface: Console
Print a string with a given level of granularity.

Specified by:
print in interface Console
Parameters:
string - The string
level - The level (one of the predefined constants).
Throws:
IOException - On failure.

setLevel

public void setLevel(int level)
Description copied from interface: Console
Set the overall granularity level of the console. Messages printed with a higher level will be ignored.

Specified by:
setLevel in interface Console
Parameters:
level - The level, one of the predefined constants. Default is WARN.

getLevel

public int getLevel()
Description copied from interface: Console
Gets the level of the console.

Specified by:
getLevel in interface Console
Returns:
The log level.


Copyright © 2011. All Rights Reserved.