SunSPOT API V2.0


com.sun.spot.util
Class Utils

java.lang.Object
  extended by com.sun.spot.util.Utils

public class Utils
extends Object


Field Summary
static int SIZE_OF_INT
           
static int SIZE_OF_LONG
           
static int SIZE_OF_SHORT
           
 
Constructor Summary
Utils()
           
 
Method Summary
static int addressPadding(int address, int padBoundary)
           
static int as6BitNumber(int number)
           
static byte[] copy(byte[] aByteArray)
           
static Vector enumToVector(Enumeration drivers)
           
static int getManifestProperty(String manifestPropertyName, int valueIfNotInManifest)
           
static String getManifestProperty(String manifestPropertyName, String valueIfNotInManifest)
           
static int getSystemProperty(String propertyName, int valueIfNotDefined)
           
static boolean isOptionSelected(String optionName, boolean defaultIfAbsent)
          Test whether a boolean option is set in the system properties
static void log(String message)
           
static int readBigEndInt(byte[] byteArray, int offset)
           
static long readBigEndLong(byte[] byteArray, int offset)
           
static int readBigEndShort(byte[] byteArray, int offset)
           
static String readDoublyNullTerminatedString(byte[] byteArray, int offset)
           
static int readLittleEndInt(byte[] byteArray, int offset)
           
static long readLittleEndLong(byte[] byteArray, int offset)
           
static int readLittleEndShort(byte[] byteArray, int offset)
           
static long readLong(String number)
           
static String readNullTerminatedString(byte[] byteArray, int offset)
           
static int readNumber(String number)
           
static void sleep(long milliseconds)
           
static String[] split(String s, char marker)
          Split a string into parts.
static String stringify(byte[] b)
           
static String withSpacesReplacedByZeros(String string)
           
static void writeBigEndInt(byte[] byteArray, int offset, int value)
           
static void writeBigEndLong(byte[] byteArray, int offset, long value)
           
static void writeBigEndShort(byte[] byteArray, int offset, int value)
           
static void writeLittleEndInt(byte[] byteArray, int offset, int value)
           
static void writeLittleEndLong(byte[] byteArray, int offset, long value)
           
static void writeLittleEndShort(byte[] byteArray, int offset, int value)
           
static void writeNullTerminatedString(byte[] byteArray, int offset, String string)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZE_OF_SHORT

public static int SIZE_OF_SHORT

SIZE_OF_INT

public static int SIZE_OF_INT

SIZE_OF_LONG

public static int SIZE_OF_LONG
Constructor Detail

Utils

public Utils()
Method Detail

log

public static void log(String message)

copy

public static byte[] copy(byte[] aByteArray)

readNumber

public static int readNumber(String number)

readLong

public static long readLong(String number)

addressPadding

public static int addressPadding(int address,
                                 int padBoundary)

readLittleEndLong

public static long readLittleEndLong(byte[] byteArray,
                                     int offset)

readLittleEndInt

public static int readLittleEndInt(byte[] byteArray,
                                   int offset)

readBigEndInt

public static int readBigEndInt(byte[] byteArray,
                                int offset)

readLittleEndShort

public static int readLittleEndShort(byte[] byteArray,
                                     int offset)

readBigEndShort

public static int readBigEndShort(byte[] byteArray,
                                  int offset)

readBigEndLong

public static long readBigEndLong(byte[] byteArray,
                                  int offset)

writeBigEndLong

public static void writeBigEndLong(byte[] byteArray,
                                   int offset,
                                   long value)

writeLittleEndLong

public static void writeLittleEndLong(byte[] byteArray,
                                      int offset,
                                      long value)

writeBigEndInt

public static void writeBigEndInt(byte[] byteArray,
                                  int offset,
                                  int value)

writeLittleEndInt

public static void writeLittleEndInt(byte[] byteArray,
                                     int offset,
                                     int value)

writeLittleEndShort

public static void writeLittleEndShort(byte[] byteArray,
                                       int offset,
                                       int value)

writeBigEndShort

public static void writeBigEndShort(byte[] byteArray,
                                    int offset,
                                    int value)

writeNullTerminatedString

public static void writeNullTerminatedString(byte[] byteArray,
                                             int offset,
                                             String string)

readNullTerminatedString

public static String readNullTerminatedString(byte[] byteArray,
                                              int offset)

readDoublyNullTerminatedString

public static String readDoublyNullTerminatedString(byte[] byteArray,
                                                    int offset)

as6BitNumber

public static int as6BitNumber(int number)

sleep

public static void sleep(long milliseconds)

getManifestProperty

public static String getManifestProperty(String manifestPropertyName,
                                         String valueIfNotInManifest)

getManifestProperty

public static int getManifestProperty(String manifestPropertyName,
                                      int valueIfNotInManifest)

getSystemProperty

public static int getSystemProperty(String propertyName,
                                    int valueIfNotDefined)

enumToVector

public static Vector enumToVector(Enumeration drivers)

stringify

public static String stringify(byte[] b)

withSpacesReplacedByZeros

public static String withSpacesReplacedByZeros(String string)

isOptionSelected

public static boolean isOptionSelected(String optionName,
                                       boolean defaultIfAbsent)
Test whether a boolean option is set in the system properties

Parameters:
optionName -
defaultIfAbsent - the value to return if optionName is absent from system properties
Returns:
true if optionName exists and has the value true, or optionName absent and defaultIfAbsent

split

public static String[] split(String s,
                             char marker)
Split a string into parts. Utils.split("foo:bar", ':') returns String[] {"foo", "bar"}

Parameters:
s - the string to split
marker - the character that marks the separation between parts
Returns:
the parts

SunSPOT API V2.0


Copyright © 2007 Sun Microsystems, Inc. All Rights Reserved.