| | |
| | | { |
| | | return (char) b; |
| | | } |
| | | |
| | | return ' '; |
| | | } |
| | | |
| | |
| | | * array using hexadecimal characters and a space between each byte. |
| | | * |
| | | * @param b The byte array containing the data. |
| | | * |
| | | * @return A string representation of the contents of the provided byte |
| | | * array using hexadecimal characters. |
| | | */ |
| | |
| | | return buffer.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves a string representation of the contents of the provided byte |
| | | * sequence using hexadecimal characters and a space between each byte. |
| | | * |
| | | * @param b The byte sequence containing the data. |
| | | * @return A string representation of the contents of the provided byte |
| | | * sequence using hexadecimal characters. |
| | | */ |
| | | public static String bytesToHex(ByteSequence b) |
| | | { |
| | | if ((b == null) || (b.length() == 0)) |
| | | { |
| | | return ""; |
| | | } |
| | | |
| | | int arrayLength = b.length(); |
| | | StringBuilder buffer = new StringBuilder((arrayLength - 1) * 3 + 2); |
| | | buffer.append(byteToHex(b.byteAt(0))); |
| | | |
| | | for (int i=1; i < arrayLength; i++) |
| | | { |
| | | buffer.append(" "); |
| | | buffer.append(byteToHex(b.byteAt(i))); |
| | | } |
| | | |
| | | return buffer.toString(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | catch (NamingException ignored) |
| | | { |
| | | // ignore |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (InterruptedException wokenUp) |
| | | { |
| | | // ignore |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | return new Iterable<T>() |
| | | { |
| | | |
| | | @Override |
| | | public Iterator<T> iterator() |
| | | { |