com.dalsemi.system
Class Debug

java.lang.Object
  |
  +--com.dalsemi.system.Debug

public class Debug
extends Object

This class encapsulates a small collection of hopefully useful debug utilities. All methods are static to keep performance up and memory usage down. We don't want these things to get in the way of the application we're trying to debug. See the DebugOutputStream class for more information on hardware connections.

See Also:
DebugOutputStream

Field Summary
static boolean defaultStreams
          true if default stream has been set; false otherwise.
 
Method Summary
static void debugDump(byte[] arr, int length)
          Dumps a byte array to the debug port.
static void debugDump(int b)
          Dumps the least significant byte of an integer to the debug port.
static void debugDump(String out)
          Dumps a String to the debug port.
static void dump(byte[] arr, int length)
          Dumps a byte array to the debug port.
static void dump(int b)
          Dumps the least significant byte of an integer to the debug port.
static void dump(String out)
          Dumps a String to the debug port.
static void hexDump(byte[] b)
          Dumps hex representation of a byte array to System.out.
static void hexDump(byte[] b, int length)
          Dumps hex representation of a byte array to System.out.
static void hexDump(int i)
          Dumps hex representation of a four byte integer to System.out.
static void hexDump(PrintStream out, byte[] b)
          Dumps hex representation of a byte array to the given PrintStream.
static void hexDump(PrintStream out, int i)
          Dumps hex representation of a four byte integer to the given PrintStream.
static void intDump(int iVal)
          Dumps hex representation of a four byte integer to System.out.
static void resetDefaultStreams()
          Sets System.out, System.err, and System.in to Null Streams.
static void setDefaultStreams()
          Sets the old TINI default streams to Serial port 0 at 115200.
static void setDefaultStreams(String port, int speed)
          Sets the old TINI default streams to the given port.
static void setNativeVerboseDebugSpew(boolean verbose)
          For internal use only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultStreams

public static boolean defaultStreams
true if default stream has been set; false otherwise.
Method Detail

hexDump

public static void hexDump(int i)
Dumps hex representation of a four byte integer to System.out.
Parameters:
i - integer to dump
See Also:
hexDump(byte[]), hexDump(byte[], int), hexDump(PrintStream, int), hexDump(PrintStream, byte[])

hexDump

public static void hexDump(PrintStream out,
                           int i)
Dumps hex representation of a four byte integer to the given PrintStream.
Parameters:
out - user supplied output PrintStream
i - integer to dump
See Also:
hexDump(int), hexDump(byte[]), hexDump(byte[], int), hexDump(PrintStream, byte[])

hexDump

public static void hexDump(byte[] b)
Dumps hex representation of a byte array to System.out.
Parameters:
b - byte array to dump
Throws:
IOException - on failed write
See Also:
hexDump(int), hexDump(byte[], int), hexDump(PrintStream, int), hexDump(PrintStream, byte[])

hexDump

public static void hexDump(PrintStream out,
                           byte[] b)
Dumps hex representation of a byte array to the given PrintStream.
Parameters:
out - user supplied output PrintStream
b - byte array to dump
Throws:
IOException - on failed write
See Also:
hexDump(int), hexDump(byte[]), hexDump(byte[], int), hexDump(PrintStream, int)

hexDump

public static void hexDump(byte[] b,
                           int length)
Dumps hex representation of a byte array to System.out.
Parameters:
b - byte array to dump
length - number of bytes to dump
See Also:
hexDump(int), hexDump(byte[]), hexDump(PrintStream, int), hexDump(PrintStream, byte[])

debugDump

public static void debugDump(String out)
Dumps a String to the debug port.
Parameters:
out - String to dump.
See Also:
debugDump(int), debugDump(byte[], int), dump(String)

dump

public static void dump(String out)
Dumps a String to the debug port.
Parameters:
out - String to dump
See Also:
dump(int), dump(byte[], int), debugDump(String)

debugDump

public static void debugDump(byte[] arr,
                             int length)
Dumps a byte array to the debug port. This will print the ASCII representation of the byte array.
Parameters:
arr - byte array to dump
length - number of bytes to dump
See Also:
debugDump(int), debugDump(String), dump(byte[],int)

dump

public static void dump(byte[] arr,
                        int length)
Dumps a byte array to the debug port. This will print the ASCII representation of the byte array.
Parameters:
arr - byte array to dump
length - number of bytes to dump
See Also:
dump(int), dump(String), debugDump(byte[], int)

debugDump

public static void debugDump(int b)
Dumps the least significant byte of an integer to the debug port. This will print the hex representation of the byte.
Parameters:
b - integer to dump
See Also:
debugDump(String), debugDump(byte[], int), dump(int)

dump

public static void dump(int b)
Dumps the least significant byte of an integer to the debug port. This will print the hex representation of the byte.
Parameters:
b - integer to dump
See Also:
dump(String), dump(byte[], int), debugDump(int)

intDump

public static void intDump(int iVal)
Dumps hex representation of a four byte integer to System.out.
Parameters:
iVal - integer to dump
See Also:
hexDump(int)

setDefaultStreams

public static void setDefaultStreams()
Sets the old TINI default streams to Serial port 0 at 115200. Binds System.out, System.err, and System.in to serial0 at 115200.

setDefaultStreams

public static void setDefaultStreams(String port,
                                     int speed)
Sets the old TINI default streams to the given port. Binds System.out, System.err, and System.in to the given port.
Parameters:
port - name of the desired port (i.e. "serial0").
speed - speed of the port. (i.e. 115200)

resetDefaultStreams

public static void resetDefaultStreams()
Sets System.out, System.err, and System.in to Null Streams.

setNativeVerboseDebugSpew

public static void setNativeVerboseDebugSpew(boolean verbose)
For internal use only.