com.dalsemi.jellybeans
Class Debug

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

public class Debug
extends java.lang.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.


Field Summary
static boolean defaultStreams
           
 
Method Summary
static boolean arrayComp(byte[] str1, int offset1, byte[] str2, int offset2, int length)
          Quick function to compare two byte arrays.
static boolean arrayComp(char[] str1, int offset1, char[] str2, int offset2, int length)
          Deprecated.  
static void arrayCopyByteChar(byte[] str1, int offset1, char[] str2, int offset2, int length)
          Copy each element in a byte array to LSB of each element character array.
static void arrayCopyCharByte(char[] str1, int offset1, byte[] str2, int offset2, int length)
          Copy LSB of each element in character array to a byte array.
static void debugDump(byte[] arr, int length)
          Dump an array to info port.
static void debugDump(int b)
          Dump a byte to info port.
static void debugDump(java.lang.String out)
          Dump a string to info port.
static void hexDump(byte[] b)
          Dump hex representation of a byte array to System.out.
static void hexDump(byte[] b, int length)
          Dump hex representation of a byte array to System.out.
static void hexDump(int i)
          Dump hex representation of a four byte int to System.out.
static void intDump(int iVal)
          Dump hex representation of a four byte int to System.out.
static void resetDefaultStreams(boolean closeIn, boolean closeOut, boolean closeErr)
          Sets System.out, System.err, and System.in to Null Streams.
static void setDefaultStreams()
          Sets the old TINI default streams to Serial port 0.
static void setNativeVerboseDebugSpew(boolean verbose)
           
 
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
Method Detail

hexDump

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

hexDump

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

hexDump

public static void hexDump(byte[] b,
                           int length)
Dump hex representation of a byte array to System.out.
Parameters:
b - byte array to dump
length - length of array

debugDump

public static void debugDump(java.lang.String out)
Dump a string to info port.
Parameters:
out - String to dump.
See Also:

debugDump

public static void debugDump(byte[] arr,
                             int length)
Dump an array to info port. This will print the ASCII representation of the byte array.
Parameters:
arr - Array to dump
length - Length of array
See Also:

debugDump

public static void debugDump(int b)
Dump a byte to info port. This will print the hex representation of the byte.
Parameters:
b -  
See Also:

intDump

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

arrayCopyCharByte

public static void arrayCopyCharByte(char[] str1,
                                     int offset1,
                                     byte[] str2,
                                     int offset2,
                                     int length)
Copy LSB of each element in character array to a byte array.
Parameters:
str1 -  
offset1 -  
str2 -  
offset2 -  
length -  
Returns:
 
See Also:

arrayCopyByteChar

public static void arrayCopyByteChar(byte[] str1,
                                     int offset1,
                                     char[] str2,
                                     int offset2,
                                     int length)
Copy each element in a byte array to LSB of each element character array.
Parameters:
str1 -  
offset1 -  
str2 -  
offset2 -  
length -  
Returns:
 
See Also:

arrayComp

public static boolean arrayComp(byte[] str1,
                                int offset1,
                                byte[] str2,
                                int offset2,
                                int length)
Quick function to compare two byte arrays.
Parameters:
str1 - first array
offset1 - first array starting offset
str2 - second array
offset2 - second array starting offset
length - number of bytes to compare
Returns:
true if arrays compare favorably.
See Also:

arrayComp

public static boolean arrayComp(char[] str1,
                                int offset1,
                                char[] str2,
                                int offset2,
                                int length)
Deprecated.  
Quick function to compare a character array to a byte array. This only looks at the LSB of the character vs. the byte in the other array.
Parameters:
str1 - first array
offset1 - first array starting offset
str2 - second array
offset2 - second array starting offset
length - number of bytes to compare
Returns:
true if arrays compare favorably.
See Also:

setDefaultStreams

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

resetDefaultStreams

public static void resetDefaultStreams(boolean closeIn,
                                       boolean closeOut,
                                       boolean closeErr)
Sets System.out, System.err, and System.in to Null Streams.
See Also:

setNativeVerboseDebugSpew

public static void setNativeVerboseDebugSpew(boolean verbose)