|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alien.enterpriseRFID.util.Converters
Various converter methods and general utilities for input I/O.
Constructor Summary | |
Converters()
|
Method Summary | |
static byte[] |
fromBinaryString(java.lang.String displayString)
Convert a displayable string of binary characters to a byte array. |
static byte[] |
fromBinaryStringMSB(java.lang.String displayString)
Convert a displayable string of binary characters to a byte array. |
static byte[] |
fromHexString(java.lang.String displayString)
Converts a displayable string of hex characters to a byte array. |
static java.lang.String |
reformatTagID(java.lang.String tagID)
Converts a tagID string in a "nonstandard" format, to a format acceptable to a reader for programming operations. |
static java.lang.String |
toAsciiString(byte byteValue)
Converts a single byte to an ASCII character, substituting [0xHH] for byte values less than 26, and [cr], [lf], [null] as appropriate. |
static java.lang.String |
toAsciiString(byte[] byteArray)
Converts a byte array to a string of ASCII characters, substituting [0xHH] for byte values less than 26, and [cr], [lf], [null] as appropriate. |
static java.lang.String |
toAsciiString(byte[] byteArray,
int offset,
int length)
Converts a byte array to a string of ASCII characters, substituting [0xHH] for byte values less than 26, and [cr], [lf], [null] as appropriate. |
static java.lang.String |
toAsciiString(java.lang.String string)
|
static java.lang.String |
toBinaryString(byte[] byteArray,
int padLength)
Converts a byte array to a string of binary characters. |
static java.lang.String |
toBinaryString(long value,
int byteCount)
Convert a long integer to a string of binary characters. |
static java.lang.String |
toHexString(byte value)
Converts a byte into a string of hex characters. |
static java.lang.String |
toHexString(byte[] byteArray,
int offset,
int length,
java.lang.String separator)
Converts a byte array to a string of hex characters, with a given String separating each byte. |
static java.lang.String |
toHexString(byte[] byteArray,
int offset,
int length,
java.lang.String separator,
boolean isTagID)
Converts a byte array to a string of hex characters, with a given String separating each byte. |
static java.lang.String |
toHexString(byte[] byteArray,
java.lang.String separator)
Converts a byte array to a string of hex characters, with a given String separating each byte. |
static java.lang.String |
toHexString(byte[] byteArray,
java.lang.String separator,
boolean isTagID)
Converts a byte array to a string of hex characters, with a given String separating each byte. |
static java.lang.String |
toHexString(int value)
Converts an int into a string of hex characters. |
static java.lang.String |
toHexString(long value,
int byteCount)
Converts a long integer to a string of hex characters. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Converters()
Method Detail |
public static java.lang.String toHexString(byte[] byteArray, java.lang.String separator)
byteArray
- the array of bytes to convertseparator
- the separator string
public static java.lang.String toHexString(byte[] byteArray, java.lang.String separator, boolean isTagID)
true
.
byteArray
- the array of bytes to convertseparator
- the separator stringisTagID
- puts in a separator every 2 bytes instead of every 1, if true
public static java.lang.String toHexString(byte[] byteArray, int offset, int length, java.lang.String separator)
byteArray
- the array of bytes to convertoffset
- the position within the byte array to start convertinglength
- the number of bytes to convertseparator
- the separator string
public static java.lang.String toHexString(byte[] byteArray, int offset, int length, java.lang.String separator, boolean isTagID)
byteArray
- the array of bytes to convertoffset
- the position within the byte array to start convertinglength
- the number of bytes to convertseparator
- the separator stringisTagID
- puts in a separator every 2 bytes instead of every 1, if true
public static java.lang.String toBinaryString(byte[] byteArray, int padLength)
byteArray
- the array of bytes to convertpadLength
- the minimum length of the resulting binary string
public static java.lang.String toHexString(long value, int byteCount)
value
- the integer to convertbyteCount
- the number of bytes to convert
public static java.lang.String toHexString(int value)
value
- the int value to convert to a hex string
public static java.lang.String toHexString(byte value)
value
- the byte value to convert to a hex string
public static java.lang.String toBinaryString(long value, int byteCount)
value
- the long integer to convertbyteCount
- the number of bytes to convert
public static byte[] fromHexString(java.lang.String displayString)
displayString
- the display string to convert
public static byte[] fromBinaryString(java.lang.String displayString)
displayString
- the displayable string to convert
public static byte[] fromBinaryStringMSB(java.lang.String displayString)
This method differs from fromBinaryString(String)
in that any remaining
bits past the last 8-bit boundary will be inserted into the most-significant
bit positions of the remaining byte.
E.g.
fromBinaryString("1") = 0x01 (00000001), while
fromBinaryStringMSB("1") = 0x80 (10000000)
This is useful for constructing tag mask bytes from an arbitrary number of bit values. The bits in a tag mask are compared to the tag ID from MSB to LSB, so any relevant bits must be in the MSB position.
displayString
- the displayable string to convert
public static java.lang.String toAsciiString(byte[] byteArray, int offset, int length)
byteArray
- the array of bytes to convertoffset
- the position within the byte array to start convertinglength
- the number of bytes to convert
public static java.lang.String toAsciiString(byte[] byteArray)
byteArray
- the array of bytes to convert
public static java.lang.String toAsciiString(java.lang.String string)
public static java.lang.String toAsciiString(byte byteValue)
byteValue
- the bytes to convert
public static java.lang.String reformatTagID(java.lang.String tagID)
First, the original string is compacted, by removing non-hex characters such as spaces, then it is reformatted to have a space between each byte value. It is understood that the original string uses 2-characters to represent each byte, e.g. "A B C D" will be interpreted as "AB CD".
tagID
- the original tagID to convert
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |