|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.dalsemi.onewire.utils.Convert
Utilities for conversion between miscellaneous datatypes.
| Method Summary | |
static byte[] |
toByteArray(int intVal)
This method constructs a LSByte byte array with 4 bytes from an int. |
static void |
toByteArray(int intVal,
byte[] byteArray)
This method constructs a LSByte byte array with 4 bytes from an int. |
static void |
toByteArray(int intVal,
byte[] byteArray,
int offset,
int len)
This method constructs a LSByte byte array with specified length from an int. |
static byte[] |
toByteArray(long longVal)
This method constructs a LSByte byte array with 8 bytes from a long. |
static void |
toByteArray(long longVal,
byte[] byteArray)
This method constructs a LSByte byte array with 8 bytes from a long. |
static void |
toByteArray(long longVal,
byte[] byteArray,
int offset,
int len)
This method constructs a LSByte byte array with specified length from a long. |
static byte[] |
toByteArray(String strData)
Converts a hex-encoded string into an array of bytes. |
static int |
toByteArray(String strData,
byte[] bData)
Converts a hex-encoded string into an array of bytes. |
static int |
toByteArray(String strData,
byte[] bData,
int offset,
int length)
Converts a hex-encoded string into an array of bytes. |
static double |
toCelsius(double fahrenheitTemperature)
Converts a temperature reading from Fahrenheit to Celsius. |
static double |
toFahrenheit(double celsiusTemperature)
Converts a temperature reading from Celsius to Fahrenheit. |
static String |
toHexString(byte[] data)
Converts a byte array into a hex-encoded String, using the provided delimeter. |
static String |
toHexString(byte[] data,
int offset,
int length)
Converts a byte array into a hex-encoded String, using the provided delimeter. |
static String |
toHexString(byte[] data,
int offset,
int length,
String delimeter)
Converts a byte array into a hex-encoded String, using the provided delimeter. |
static String |
toHexString(byte[] data,
String delimeter)
Converts a byte array into a hex-encoded String, using the provided delimeter. |
static String |
toHexString(int iValue)
Converts a long into a hex-encoded string (LSByte). |
static String |
toHexString(long lValue)
Converts a long into a hex-encoded string (LSByte). |
static int |
toInt(byte[] byteArray)
This method constructs an int from a LSByte byte array of specified length. |
static int |
toInt(byte[] byteArray,
int offset,
int len)
This method constructs an int from a LSByte byte array of specified length. |
static int |
toInt(String strData)
Converts a hex-encoded string (LSByte) into an int. |
static long |
toLong(byte[] byteArray)
This method constructs a long from a LSByte byte array of specified length. |
static long |
toLong(byte[] byteArray,
int offset,
int len)
This method constructs a long from a LSByte byte array of specified length. |
static long |
toLong(String strData)
Converts a hex-encoded string (LSByte) into a long. |
static String |
toString(double dubbel,
int nFrac)
Converts a double value into a string with the specified number of digits after the decimal place. |
static String |
toString(float flote,
int nFrac)
Converts a float value into a string with the specified number of digits after the decimal place. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static final double toFahrenheit(double celsiusTemperature)
celsiusTemperature - temperature value in Celsiuspublic static final double toCelsius(double fahrenheitTemperature)
fahrenheitTemperature - temperature value in Fahrenheit
public static final long toLong(byte[] byteArray,
int offset,
int len)
byteArray - byte array to convert to a long (LSByte first)offset - byte offset into the array where to start to convertlen - number of bytes to use to convert to a longpublic static final long toLong(byte[] byteArray)
byteArray - byte array to convert to a long (LSByte first)
public static final void toByteArray(long longVal,
byte[] byteArray,
int offset,
int len)
longVal - the long value to convert to a byte array.byteArray - LSByte first byte array, holds bytes from longoffset - byte offset into the arraylen - number of bytes to get
public static final void toByteArray(long longVal,
byte[] byteArray)
longVal - the long value to convert to a byte array.byteArray - LSByte first byte array, holds bytes from longpublic static final byte[] toByteArray(long longVal)
longVal - the long value to convert to a byte array.
public static final int toInt(byte[] byteArray,
int offset,
int len)
byteArray - byte array to convert to an int (LSByte first)offset - byte offset into the array where to start to convertlen - number of bytes to use to convert to an intpublic static final int toInt(byte[] byteArray)
byteArray - byte array to convert to an int (LSByte first)
public static final void toByteArray(int intVal,
byte[] byteArray,
int offset,
int len)
intVal - the int value to convert to a byte array.byteArray - LSByte first byte array, holds bytes from intoffset - byte offset into the arraylen - number of bytes to get
public static final void toByteArray(int intVal,
byte[] byteArray)
intVal - the int value to convert to a byte array.byteArray - LSByte first byte array, holds bytes from longpublic static final byte[] toByteArray(int intVal)
longVal - the long value to convert to a byte array.public static final byte[] toByteArray(String strData)
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}
strData - hex-encoded numerical string
public static final int toByteArray(String strData,
byte[] bData)
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}
strData - hex-encoded numerical stringbData - byte[] which will hold the decoded bytes
public static final int toByteArray(String strData,
byte[] bData,
int offset,
int length)
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}
strData - hex-encoded numerical stringbData - byte[] which will hold the decoded bytesoffset - the offset into bData to start placing byteslength - the maximum number of bytes to convertpublic static final String toHexString(byte[] data)
data - The byte[] to convert to a hex-encoded string
public static final String toHexString(byte[] data,
int offset,
int length)
data - The byte[] to convert to a hex-encoded stringoffset - the offset to start converting byteslength - the number of bytes to convert
public static final String toHexString(byte[] data,
String delimeter)
data - The byte[] to convert to a hex-encoded stringdelimeter - the delimeter to place between each byte of data
public static final String toHexString(byte[] data,
int offset,
int length,
String delimeter)
data - The byte[] to convert to a hex-encoded stringoffset - the offset to start converting byteslength - the number of bytes to convertdelimeter - the delimeter to place between each byte of datapublic static final long toLong(String strData)
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
strData - hex-encoded numerical stringpublic static final String toHexString(long lValue)
Converts a long into a hex-encoded string (LSByte).
lValue - the long integer to encodepublic static final int toInt(String strData)
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
strData - hex-encoded numerical stringpublic static final String toHexString(int iValue)
Converts a long into a hex-encoded string (LSByte).
iValue - the integer to encode
public static final String toString(double dubbel,
int nFrac)
Converts a double value into a string with the specified number of digits after the decimal place.
dubbel - the double value to convert to a stringnFrac - the number of digits to display after the decimal point
public static final String toString(float flote,
int nFrac)
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.
flote - the float value to convert to a stringnFrac - the number of digits to display after the decimal point
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||