1-Wire API for .NET Version 4.00
Static Public Member Functions | Static Package Attributes

Convert Class Reference

Utilities for conversion between miscellaneous datatypes. More...

List of all members.

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.

Detailed Description

Utilities for conversion between miscellaneous datatypes.

Version:
1.00, 28 December 2001
Author:
SH

Member Function Documentation

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:
longValthe long value to convert to a byte array.
byteArrayLSByte first byte array, holds bytes from long
offsetbyte offset into the array
lennumber of bytes to get
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:
intValthe int value to convert to a byte array.
byteArrayLSByte first byte array, holds bytes from int
offsetbyte offset into the array
lennumber 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:
intValthe int value to convert to a byte array.
byteArrayLSByte first byte array, holds bytes from long
static final void toByteArray ( long  longVal,
byte[]  byteArray 
) [static]

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

Parameters:
longValthe long value to convert to a byte array.
byteArrayLSByte 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:
longValthe 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:
strDatahex-encoded numerical string
Returns:
byte[] the decoded bytes
static final byte [] toByteArray ( long  longVal) [static]

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

Parameters:
longValthe long value to convert to a byte array.
Returns:
value constructed from 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:
strDatahex-encoded numerical string
bDatabyte[] 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:
strDatahex-encoded numerical string
bDatabyte[] which will hold the decoded bytes
offsetthe offset into bData to start placing bytes
lengththe maximum number of bytes to convert
Returns:
The number of bytes converted
static final double toCelsius ( double  fahrenheitTemperature) [static]

Converts a temperature reading from Fahrenheit to Celsius.

Parameters:
fahrenheitTemperaturetemperature value in Fahrenheit
Returns:
the Celsius conversion of the supplied temperature
static final double toFahrenheit ( double  celsiusTemperature) [static]

Converts a temperature reading from Celsius to Fahrenheit.

Parameters:
celsiusTemperaturetemperature value in Celsius
Returns:
the Fahrenheit conversion of the supplied temperature
static final String toHexString ( char[]  data) [static]

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

Parameters:
dataThe char[] to convert to a hex-encoded string
Returns:
Hex-encoded String
static final String toHexString ( byte[]  data) [static]

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

Parameters:
dataThe 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:
dataThe byte[] to convert to a hex-encoded string
offsetthe offset to start converting bytes
lengththe 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:
dataThe byte[] to convert to a hex-encoded string
delimeterthe 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:
dataThe byte[] to convert to a hex-encoded string
offsetthe offset to start converting bytes
lengththe number of bytes to convert
delimeterthe delimeter to place between each byte of data
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:
dataThe char[] to convert to a hex-encoded string
delimeterthe 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:
bValuethe byte to encode
Returns:
String 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:
dataThe char[] to convert to a hex-encoded string
offsetthe offset to start converting bytes
lengththe number of bytes to convert
Returns:
Hex-encoded String
static final String toHexString ( int  iValue) [static]

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

Parameters:
iValuethe integer to encode
Returns:
String 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:
dataThe char[] to convert to a hex-encoded string
offsetthe offset to start converting bytes
lengththe number of bytes to convert
delimeterthe 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:
bValuethe byte to encode
Returns:
String Hex-encoded String
static final String toHexString ( long  lValue) [static]

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

Parameters:
lValuethe long integer to encode
Returns:
String Hex-encoded String
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:
byteArraybyte array to convert to an int (LSByte first)
Returns:
value constructed from bytes
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:
strDatahex-encoded numerical string
Returns:
the decoded int
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:
byteArraybyte array to convert to an int (LSByte first)
offsetbyte offset into the array where to start to convert
lennumber of bytes to use to convert to an int
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:
byteArraybyte array to convert to a long (LSByte first)
Returns:
value constructed from bytes
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:
strDatahex-encoded numerical string
Returns:
the decoded long
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:
byteArraybyte array to convert to a long (LSByte first)
offsetbyte offset into the array where to start to convert
lennumber of bytes to use to convert to a long
Returns:
value constructed from bytes
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:
dubbelthe double value to convert to a string
nFracthe 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:
flotethe float value to convert to a string
nFracthe 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: