com.dalsemi.onewire.utils
Class Address

java.lang.Object
  |
  +--com.dalsemi.onewire.utils.Address

public class Address
extends java.lang.Object

Utilities to translate and verify the 1-Wire Network address.

Version:
0.00, 21 August 2000

Method Summary
static boolean isValid(byte[] address)
          Checks the CRC8 calculation of this 1-Wire Network address.
static boolean isValid(long address)
          Checks the CRC8 calculation of this 1-Wire Network address.
static boolean isValid(java.lang.String address)
          Checks the CRC8 calculation of this 1-Wire Network address.
static byte[] toByteArray(long address)
          Convert an iButton or 1-Wire device address as a long (little endian) into an array of bytes.
static byte[] toByteArray(java.lang.String address)
          Converts a 1-Wire Network Address string (big endian) to a byte array (little endian).
static long toLong(byte[] address)
          Converts a 1-Wire Network Address to a long (little endian).
static long toLong(java.lang.String address)
          Converts a 1-Wire Network Address to a long (little endian).
static java.lang.String toString(byte[] address)
          Converts a 1-Wire Network address byte array (little endian) to a hex string representation (big endian).
static java.lang.String toString(long address)
          Converts a 1-Wire Network address long (little endian) to a hex string representation (big endian).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isValid

public static boolean isValid(byte[] address)
Checks the CRC8 calculation of this 1-Wire Network address.
Parameters:
address - iButton or 1-Wire Network address to verify
Returns:
true if the family code is non-zero and the CRC8 calculation is correct.

isValid

public static boolean isValid(java.lang.String address)
Checks the CRC8 calculation of this 1-Wire Network address.
Parameters:
address - iButton or 1-Wire Network address to verify
Returns:
true if the family code is non-zero and the CRC8 calculation is correct.

isValid

public static boolean isValid(long address)
Checks the CRC8 calculation of this 1-Wire Network address.
Parameters:
address - iButton or 1-Wire Network address to verify
Returns:
true if the family code is non-zero and the CRC8 calculation is correct.

toString

public static java.lang.String toString(byte[] address)
Converts a 1-Wire Network address byte array (little endian) to a hex string representation (big endian).
Parameters:
address, - family code first.
Returns:
address represented in a String, family code last.

toString

public static java.lang.String toString(long address)
Converts a 1-Wire Network address long (little endian) to a hex string representation (big endian).
Parameters:
address, - family code first.
Returns:
address represented in a long, little endian.

toByteArray

public static byte[] toByteArray(java.lang.String address)
Converts a 1-Wire Network Address string (big endian) to a byte array (little endian).
Parameters:
address, - family code last.
Returns:
address represented in a byte array, family code (LS byte) first.

toByteArray

public static byte[] toByteArray(long address)
Convert an iButton or 1-Wire device address as a long (little endian) into an array of bytes.

toLong

public static long toLong(byte[] address)
Converts a 1-Wire Network Address to a long (little endian).

toLong

public static long toLong(java.lang.String address)
Converts a 1-Wire Network Address to a long (little endian).