|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.onewire.debug.Debug
This class is intended to help both developers of the 1-Wire API for
Java and developers using the 1-Wire API for Java to have a standard
method for printing debug messages. Applications that want to see debug messages
should call the setDebugMode(boolean)
method.
Classes that want to print information under debugging
circumstances should call the debug(String)
method.
Debug printing is turned off by default.
Constructor Summary | |
Debug()
|
Method Summary | |
static void |
debug(String x)
Prints the specified java.lang.String object
if debug mode is enabled. |
static void |
debug(String lbl,
byte[] bytes)
Prints the specified array of bytes with a given label if debug mode is enabled. |
static void |
debug(String lbl,
byte[] bytes,
int offset,
int length)
Prints the specified array of bytes with a given label if debug mode is enabled. |
static void |
debug(String lbl,
Throwable t)
Prints the specified exception with a given label if debug mode is enabled. |
static boolean |
getDebugMode()
Gets the debug printing mode for this application. |
static void |
setDebugMode(boolean onoff)
Sets the debug printing mode for this application. |
static void |
setPrintStream(PrintStream outStream)
Sets the output stream for printing the debug info. |
static void |
stackTrace()
Prints out an exception stack trace for debugging purposes. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Debug()
Method Detail |
public static final void setDebugMode(boolean onoff)
true
- to see debug messages, false
to suppress thempublic static final boolean getDebugMode()
true
indicates debug messages are on,
false
supresses them.public static final void setPrintStream(PrintStream outStream)
out
- the output stream for printing the debug info.public static final void debug(String x)
java.lang.String
object
if debug mode is enabled. This method calls PrintStream.println(String)
,
and pre-pends the String
">> " to the message, so
taht if a program were to call (when debug mode was enabled):
com.dalsemi.onewire.debug.Debug.debug("Some notification...");
the resulting output would look like:
>> Some notification...
x
- the message to print out if in debug modepublic static final void debug(String lbl, byte[] bytes)
PrintStream.println(String)
,
and pre-pends the String
">> " to the message, so
taht if a program were to call (when debug mode was enabled):
com.dalsemi.onewire.debug.Debug.debug("Some notification...", myBytes);
the resulting output would look like:
>> my label
>> FF F1 F2 F3 F4 F5 F6 FF
lbl
- the message to print out above the arraybytes
- the byte array to print outpublic static final void debug(String lbl, byte[] bytes, int offset, int length)
PrintStream.println(String)
,
and pre-pends the String
">> " to the message, so
taht if a program were to call (when debug mode was enabled):
com.dalsemi.onewire.debug.Debug.debug("Some notification...", myBytes, 0, 8);
the resulting output would look like:
>> my label
>> FF F1 F2 F3 F4 F5 F6 FF
lbl
- the message to print out above the arraybytes
- the byte array to print outoffset
- the offset to start printing from the arraylength
- the number of bytes to print from the arraypublic static final void debug(String lbl, Throwable t)
PrintStream.println(String)
,
and pre-pends the String
">> " to the message, so
taht if a program were to call (when debug mode was enabled):
com.dalsemi.onewire.debug.Debug.debug("Some notification...", exception);
the resulting output would look like:
>> my label
>> OneWireIOException: Device Not Present
lbl
- the message to print out above the arraybytes
- the byte array to print outoffset
- the offset to start printing from the arraylength
- the number of bytes to print from the arraypublic static final void stackTrace()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |