Convert Class Reference

List of all members.


Detailed Description

Utilities for conversion between miscellaneous datatypes.

Version:
1.00, 28 December 2001
Author:
SH

Static Public Member Functions

static final double toFahrenheit (double celsiusTemperature)
 Converts a temperature reading from Celsius to Fahrenheit.
static final double toCelsius (double fahrenheitTemperature)
 Converts a temperature reading from Fahrenheit to Celsius.
static final long toLong (byte[] byteArray, int offset, int len)
 This method constructs a long from a LSByte byte array of specified length.
static final long toLong (byte[] byteArray)
 This method constructs a long from a LSByte byte array of specified length.
static final void toByteArray (long longVal, byte[] byteArray, int offset, int len)
 This method constructs a LSByte byte array with specified length from a long.
static final void toByteArray (long longVal, byte[] byteArray)
 This method constructs a LSByte byte array with 8 bytes from a long.
static final byte[] toByteArray (long longVal)
 This method constructs a LSByte byte array with 8 bytes from a long.
static final int toInt (byte[] byteArray, int offset, int len)
 This method constructs an int from a LSByte byte array of specified length.
static final int toInt (byte[] byteArray)
 This method constructs an int from a LSByte byte array of specified length.
static final void toByteArray (int intVal, byte[] byteArray, int offset, int len)
 This method constructs a LSByte byte array with specified length from an int.
static final void toByteArray (int intVal, byte[] byteArray)
 This method constructs a LSByte byte array with 4 bytes from an int.
static final byte[] toByteArray (int intVal)
 This method constructs a LSByte byte array with 4 bytes from an int.
static final byte[] toByteArray (String strData) throws ConvertException
static final int toByteArray (String strData, byte[] bData) throws ConvertException
static final int toByteArray (String strData, byte[] bData, int offset, int length) throws ConvertException
static final String toHexString (byte[] data)
 Converts a byte array into a hex-encoded String, using the provided delimeter.
static final String toHexString (byte[] data, int offset, int length)
 Converts a byte array into a hex-encoded String, using the provided delimeter.
static final String toHexString (byte[] data, String delimeter)
 Converts a byte array into a hex-encoded String, using the provided delimeter.
static final String toHexString (byte[] data, int offset, int length, String delimeter)
 Converts a byte array into a hex-encoded String, using the provided delimeter.
static final String toHexString (byte bValue)
static final String toHexString (char[] data)
 Converts a char array into a hex-encoded String, using the provided delimeter.
static final String toHexString (char[] data, int offset, int length)
 Converts a byte array into a hex-encoded String, using the provided delimeter.
static final String toHexString (char[] data, String delimeter)
 Converts a char array into a hex-encoded String, using the provided delimeter.
static final String toHexString (char[] data, int offset, int length, String delimeter)
 Converts a char array into a hex-encoded String, using the provided delimeter.
static final String toHexString (char bValue)
static final long toLong (String strData) throws ConvertException
static final String toHexString (long lValue)
static final int toInt (String strData) throws ConvertException
static final String toHexString (int iValue)
static final String toString (double dubbel, int nFrac)
static final String toString (float flote, int nFrac)

Static Package Attributes

static final double d_POSITIVE_INFINITY = 1.0d / 0.0d
 Field Double NEGATIVE_INFINITY.
static final double d_NEGATIVE_INFINITY = -1.0d / 0.0d
 Field Double NEGATIVE_INFINITY.
static final float f_POSITIVE_INFINITY = 1.0f / 0.0f
 Field Float NEGATIVE_INFINITY.
static final float f_NEGATIVE_INFINITY = -1.0f / 0.0f
 Field Float NEGATIVE_INFINITY.

Member Function Documentation

static final double toFahrenheit ( double  celsiusTemperature  )  [static]

Converts a temperature reading from Celsius to Fahrenheit.

Parameters:
celsiusTemperature temperature value in Celsius
Returns:
the Fahrenheit conversion of the supplied temperature

static final double toCelsius ( double  fahrenheitTemperature  )  [static]

Converts a temperature reading from Fahrenheit to Celsius.

Parameters:
fahrenheitTemperature temperature value in Fahrenheit
Returns:
the Celsius conversion of the supplied temperature

static final long toLong ( byte[]  byteArray,
int  offset,
int  len 
) [static]

This method constructs a long from a LSByte byte array of specified length.

Parameters:
byteArray byte array to convert to a long (LSByte first)
offset byte offset into the array where to start to convert
len number of bytes to use to convert to a long
Returns:
value constructed from bytes

static final long toLong ( byte[]  byteArray  )  [static]

This method constructs a long from a LSByte byte array of specified length.

Uses 8 bytes starting at the first index.

Parameters:
byteArray byte array to convert to a long (LSByte first)
Returns:
value constructed from bytes

static final void toByteArray ( long  longVal,
byte[]  byteArray,
int  offset,
int  len 
) [static]

This method constructs a LSByte byte array with specified length from a long.

Parameters:
longVal the long value to convert to a byte array.
byteArray LSByte first byte array, holds bytes from long
offset byte offset into the array
len number of bytes to get
Returns:
value constructed from bytes

static final void toByteArray ( long  longVal,
byte[]  byteArray 
) [static]

This method constructs a LSByte byte array with 8 bytes from a long.

Parameters:
longVal the long value to convert to a byte array.
byteArray LSByte first byte array, holds bytes from long

static final byte [] toByteArray ( long  longVal  )  [static]

This method constructs a LSByte byte array with 8 bytes from a long.

Parameters:
longVal the long value to convert to a byte array.
Returns:
value constructed from bytes

static final int toInt ( byte[]  byteArray,
int  offset,
int  len 
) [static]

This method constructs an int from a LSByte byte array of specified length.

Parameters:
byteArray byte array to convert to an int (LSByte first)
offset byte offset into the array where to start to convert
len number of bytes to use to convert to an int
Returns:
value constructed from bytes

static final int toInt ( byte[]  byteArray  )  [static]

This method constructs an int from a LSByte byte array of specified length.

Uses 4 bytes starting at the first index.

Parameters:
byteArray byte array to convert to an int (LSByte first)
Returns:
value constructed from bytes

static final void toByteArray ( int  intVal,
byte[]  byteArray,
int  offset,
int  len 
) [static]

This method constructs a LSByte byte array with specified length from an int.

Parameters:
intVal the int value to convert to a byte array.
byteArray LSByte first byte array, holds bytes from int
offset byte offset into the array
len number of bytes to get

static final void toByteArray ( int  intVal,
byte[]  byteArray 
) [static]

This method constructs a LSByte byte array with 4 bytes from an int.

Parameters:
intVal the int value to convert to a byte array.
byteArray LSByte first byte array, holds bytes from long

static final byte [] toByteArray ( int  intVal  )  [static]

This method constructs a LSByte byte array with 4 bytes from an int.

Parameters:
longVal the long value to convert to a byte array.
Returns:
value constructed from bytes

static final byte [] toByteArray ( String  strData  )  throws ConvertException [static]

Converts a hex-encoded string into an array of bytes.

To illustrate the rules for parsing, the following String:
"FF 0 1234 567"
becomes:
byte[]{0xFF,0x00,0x12,0x34,0x56,0x07}

Parameters:
strData hex-encoded numerical string
Returns:
byte[] the decoded bytes

static final int toByteArray ( String  strData,
byte[]  bData 
) throws ConvertException [static]

Converts a hex-encoded string into an array of bytes.

To illustrate the rules for parsing, the following String:
"FF 0 1234 567"
becomes:
byte[]{0xFF,0x00,0x12,0x34,0x56,0x07}

Parameters:
strData hex-encoded numerical string
bData byte[] which will hold the decoded bytes
Returns:
The number of bytes converted

static final int toByteArray ( String  strData,
byte[]  bData,
int  offset,
int  length 
) throws ConvertException [static]

Converts a hex-encoded string into an array of bytes.

To illustrate the rules for parsing, the following String:
"FF 0 1234 567"
becomes:
byte[]{0xFF,0x00,0x12,0x34,0x56,0x07}

Parameters:
strData hex-encoded numerical string
bData byte[] which will hold the decoded bytes
offset the offset into bData to start placing bytes
length the maximum number of bytes to convert
Returns:
The number of bytes converted

static final String toHexString ( byte[]  data  )  [static]

Converts a byte array into a hex-encoded String, using the provided delimeter.

Parameters:
data The byte[] to convert to a hex-encoded string
Returns:
Hex-encoded String

static final String toHexString ( byte[]  data,
int  offset,
int  length 
) [static]

Converts a byte array into a hex-encoded String, using the provided delimeter.

Parameters:
data The byte[] to convert to a hex-encoded string
offset the offset to start converting bytes
length the number of bytes to convert
Returns:
Hex-encoded String

static final String toHexString ( byte[]  data,
String  delimeter 
) [static]

Converts a byte array into a hex-encoded String, using the provided delimeter.

Parameters:
data The byte[] to convert to a hex-encoded string
delimeter the delimeter to place between each byte of data
Returns:
Hex-encoded String

static final String toHexString ( byte[]  data,
int  offset,
int  length,
String  delimeter 
) [static]

Converts a byte array into a hex-encoded String, using the provided delimeter.

Parameters:
data The byte[] to convert to a hex-encoded string
offset the offset to start converting bytes
length the number of bytes to convert
delimeter the delimeter to place between each byte of data
Returns:
Hex-encoded String

static final String toHexString ( byte  bValue  )  [static]

Converts a single byte into a hex-encoded string.

Parameters:
bValue the byte to encode
Returns:
String Hex-encoded String

static final String toHexString ( char[]  data  )  [static]

Converts a char array into a hex-encoded String, using the provided delimeter.

Parameters:
data The char[] to convert to a hex-encoded string
Returns:
Hex-encoded String

static final String toHexString ( char[]  data,
int  offset,
int  length 
) [static]

Converts a byte array into a hex-encoded String, using the provided delimeter.

Parameters:
data The char[] to convert to a hex-encoded string
offset the offset to start converting bytes
length the number of bytes to convert
Returns:
Hex-encoded String

static final String toHexString ( char[]  data,
String  delimeter 
) [static]

Converts a char array into a hex-encoded String, using the provided delimeter.

Parameters:
data The char[] to convert to a hex-encoded string
delimeter the delimeter to place between each byte of data
Returns:
Hex-encoded String

static final String toHexString ( char[]  data,
int  offset,
int  length,
String  delimeter 
) [static]

Converts a char array into a hex-encoded String, using the provided delimeter.

Parameters:
data The char[] to convert to a hex-encoded string
offset the offset to start converting bytes
length the number of bytes to convert
delimeter the delimeter to place between each byte of data
Returns:
Hex-encoded String

static final String toHexString ( char  bValue  )  [static]

Converts a single character into a hex-encoded string.

Parameters:
bValue the byte to encode
Returns:
String Hex-encoded String

static final long toLong ( String  strData  )  throws ConvertException [static]

Converts a hex-encoded string (LSByte) into a long.

To illustrate the rules for parsing, the following String:
"FF 0 1234 567 12 03"
becomes:
long 0x03120756341200ff

Parameters:
strData hex-encoded numerical string
Returns:
the decoded long

static final String toHexString ( long  lValue  )  [static]

Converts a long into a hex-encoded string (LSByte).

Parameters:
lValue the long integer to encode
Returns:
String Hex-encoded String

static final int toInt ( String  strData  )  throws ConvertException [static]

Converts a hex-encoded string (LSByte) into an int.

To illustrate the rules for parsing, the following String:
"FF 0 1234 567 12 03"
becomes:
long 0x03120756341200ff

Parameters:
strData hex-encoded numerical string
Returns:
the decoded int

static final String toHexString ( int  iValue  )  [static]

Converts an integer into a hex-encoded string (LSByte).

Parameters:
iValue the integer to encode
Returns:
String Hex-encoded String

static final String toString ( double  dubbel,
int  nFrac 
) [static]

Converts a double value into a string with the specified number of digits after the decimal place.

Parameters:
dubbel the double value to convert to a string
nFrac the number of digits to display after the decimal point
Returns:
String representation of the double value with the specified number of digits after the decimal place.

static final String toString ( float  flote,
int  nFrac 
) [static]

Converts a float value into a string with the specified number of digits after the decimal place.

Note: this function does not properly handle special case float values such as Infinity and NaN.

Parameters:
flote the float value to convert to a string
nFrac the number of digits to display after the decimal point
Returns:
String representation of the float value with the specified number of digits after the decimal place.


The documentation for this class was generated from the following file:

Generated on Thu Aug 28 15:42:37 2008 for 1-Wire API for .NET by  doxygen 1.5.6