org.knowceans.util
Class Print

java.lang.Object
  extended by org.knowceans.util.Print

public class Print
extends java.lang.Object

convenience class to print information. Can also be used to construct strings, then the internal PrintWriter writes to a StringBuilder that can be output as a String object or to stdout (string() method).

Author:
gregor

Constructor Summary
Print()
           
 
Method Summary
static void arrays(java.lang.Object a, java.lang.Object... b)
          checks whether there are arrays in the objects
static void arraysf(java.lang.String format, java.lang.Object... b)
          formats each array element to format.
static void arraysSep(java.lang.String sep, java.lang.Object... b)
          checks whether there are arrays in the objects
static java.lang.String classmethod()
          returns a string with class and method position of the current position
static java.lang.String fileline()
          returns a string with file and line position of the current location
static java.io.PrintStream getOutput()
          get current output stream
static java.lang.String getString()
          get the last string that has been written to (if any)
static void main(java.lang.String[] args)
           
static void newString()
          setup the Print object for a new string output
static void setOutput(java.io.PrintStream s)
          sets the output stream for the printer
static void setString(java.lang.StringBuilder sb)
          reset output to write to a string buffer
static void setToStderr()
          set output to stderr
static void setToStdout()
          set output to stdout
static void string()
          get the last string that has been written to (if any)
static void strings(java.lang.Object a, java.lang.Object... b)
          prints all objects via tostring methods
static void stringSep(java.lang.String sep, java.lang.Object... b)
          prints all objects via tostring methods, separated by sep
static void whereami()
          prints the stack element of the current code location
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Print

public Print()
Method Detail

setOutput

public static void setOutput(java.io.PrintStream s)
sets the output stream for the printer

Parameters:
s - null to disable

setString

public static void setString(java.lang.StringBuilder sb)
reset output to write to a string buffer

Parameters:
sb -

setToStdout

public static void setToStdout()
set output to stdout


setToStderr

public static void setToStderr()
set output to stderr


newString

public static void newString()
setup the Print object for a new string output


getOutput

public static java.io.PrintStream getOutput()
get current output stream

Returns:

strings

public static void strings(java.lang.Object a,
                           java.lang.Object... b)
prints all objects via tostring methods

Parameters:
a -
b -

stringSep

public static void stringSep(java.lang.String sep,
                             java.lang.Object... b)
prints all objects via tostring methods, separated by sep

Parameters:
a -
b -

arrays

public static void arrays(java.lang.Object a,
                          java.lang.Object... b)
checks whether there are arrays in the objects

Parameters:
a -
b -

arraysSep

public static void arraysSep(java.lang.String sep,
                             java.lang.Object... b)
checks whether there are arrays in the objects

Parameters:
a -
b -

arraysf

public static void arraysf(java.lang.String format,
                           java.lang.Object... b)
formats each array element to format.

Parameters:
a -
b -

whereami

public static void whereami()
prints the stack element of the current code location


fileline

public static java.lang.String fileline()
returns a string with file and line position of the current location

Returns:

classmethod

public static java.lang.String classmethod()
returns a string with class and method position of the current position

Returns:

getString

public static java.lang.String getString()
get the last string that has been written to (if any)

Returns:

string

public static void string()
get the last string that has been written to (if any)


main

public static void main(java.lang.String[] args)