com.voytechs.jnetstream.util
Class NumberUtils

java.lang.Object
  extended by com.voytechs.jnetstream.util.NumberUtils

public class NumberUtils
extends java.lang.Object

Utility class with various number formating routines.


Field Summary
static java.lang.String NEWLINE_CHAR
           
static java.lang.String NONPRINTABLE_CHAR
           
static java.lang.String space
           
static java.lang.String SPACE_CHAR
           
 
Constructor Summary
NumberUtils()
           
 
Method Summary
static java.lang.String hexdump(byte[] a)
           
static java.lang.String hexdump(byte[] a, int addressOffset)
           
static java.lang.String hexdump(byte[] a, java.lang.String prefix, boolean indentFirstLine)
           
static java.util.Enumeration hexdumpEnumerator(byte[] data)
          HEXDUMP methods.
static java.util.Enumeration hexdumpEnumerator(byte[] data, java.lang.String prefix, boolean indentFirstLine)
           
static java.util.Enumeration hexdumpEnumerator(byte[] data, java.lang.String prefix, boolean indentFirstLine, int addressOffset, int dataOffset)
           
static java.lang.String hexLine(byte[] a, java.lang.String prefix, int address, int i)
           
static java.lang.String hexLineAddress(int address)
           
static java.lang.String hexLineData(byte[] data, int offset)
           
static java.lang.String hexLineText(byte[] data, int offset)
           
static long longValue(byte[] b)
          number parsing
static void main(java.lang.String[] args)
          Test function for NumberUtils
static java.lang.String pad(java.lang.String s, int count)
          String padding routine
static java.lang.String padSuffix(java.lang.String s, int count)
          String padding routine
static Address parseAddress(java.lang.String word)
           
static byte[] parseIntoArray(byte[] r, java.lang.String[] c, int radix)
           
static java.lang.Number parseNumber(java.lang.String word)
           
static java.lang.String timestampDeltaFormat(long micros)
           
static java.lang.String timestampDeltaFormat(java.sql.Timestamp t1, java.sql.Timestamp t2)
           
static long timestampSubtract(java.sql.Timestamp t1, java.sql.Timestamp t2)
          Utility class that manipulates Timestamps
static java.lang.String toHexString(byte b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONPRINTABLE_CHAR

public static final java.lang.String NONPRINTABLE_CHAR
See Also:
Constant Field Values

NEWLINE_CHAR

public static final java.lang.String NEWLINE_CHAR
See Also:
Constant Field Values

SPACE_CHAR

public static final java.lang.String SPACE_CHAR
See Also:
Constant Field Values

space

public static final java.lang.String space
See Also:
Constant Field Values
Constructor Detail

NumberUtils

public NumberUtils()
Method Detail

pad

public static java.lang.String pad(java.lang.String s,
                                   int count)
String padding routine


padSuffix

public static java.lang.String padSuffix(java.lang.String s,
                                         int count)
String padding routine


longValue

public static long longValue(byte[] b)
number parsing


parseAddress

public static Address parseAddress(java.lang.String word)

parseIntoArray

public static byte[] parseIntoArray(byte[] r,
                                    java.lang.String[] c,
                                    int radix)

parseNumber

public static java.lang.Number parseNumber(java.lang.String word)

hexdumpEnumerator

public static java.util.Enumeration hexdumpEnumerator(byte[] data)
HEXDUMP methods.


hexdumpEnumerator

public static java.util.Enumeration hexdumpEnumerator(byte[] data,
                                                      java.lang.String prefix,
                                                      boolean indentFirstLine)

hexdumpEnumerator

public static java.util.Enumeration hexdumpEnumerator(byte[] data,
                                                      java.lang.String prefix,
                                                      boolean indentFirstLine,
                                                      int addressOffset,
                                                      int dataOffset)

hexdump

public static java.lang.String hexdump(byte[] a)

hexdump

public static java.lang.String hexdump(byte[] a,
                                       java.lang.String prefix,
                                       boolean indentFirstLine)

hexdump

public static java.lang.String hexdump(byte[] a,
                                       int addressOffset)

hexLine

public static java.lang.String hexLine(byte[] a,
                                       java.lang.String prefix,
                                       int address,
                                       int i)

hexLineText

public static java.lang.String hexLineText(byte[] data,
                                           int offset)

hexLineAddress

public static java.lang.String hexLineAddress(int address)

hexLineData

public static java.lang.String hexLineData(byte[] data,
                                           int offset)

toHexString

public static java.lang.String toHexString(byte b)

main

public static void main(java.lang.String[] args)
Test function for NumberUtils

Parameters:
args - command line arguments

timestampSubtract

public static long timestampSubtract(java.sql.Timestamp t1,
                                     java.sql.Timestamp t2)
Utility class that manipulates Timestamps

Returns:
micros (10e6) seconds as the delta betwen t2 to and t1.

timestampDeltaFormat

public static java.lang.String timestampDeltaFormat(java.sql.Timestamp t1,
                                                    java.sql.Timestamp t2)

timestampDeltaFormat

public static java.lang.String timestampDeltaFormat(long micros)