List of utility methods to do Byte Create
byte | toByte(String string) to Byte return (byte) toInt(string); |
byte[] | toByte(String string) to Byte byte[] data = new byte[string.length() / 2]; int loc = 0; for (int i = 0; i < string.length(); i += 2) { int hex = Integer.decode("0x" + string.charAt(i) + "" + string.charAt(i + 1)); data[loc++] = (byte) hex; return data; |
byte | toByte(String string) to Byte assert string.length() == 2; byte b = (byte) ((byte) (decodeHexChar(string.charAt(0)) << 4) | (byte) (decodeHexChar(string.charAt(1)))); return b; |
Byte | toByte(String value) to Byte if (null == value) { return null; value = value.trim(); if ("null".equals(value)) { return null; return Byte.parseByte(value); ... |
Byte | toByte(String value) to Byte if (value != null) { try { return Byte.parseByte(value); } catch (NumberFormatException e) { return null; |
byte | toByte(T value) to Byte return (value != null ? value.byteValue() : null);
|
int | toByteBE(int value, byte[] dst, int offset) int to 32bit dst[offset] = (byte) ((value >> 24) & 0xFF); dst[++offset] = (byte) ((value >> 16) & 0xFF); dst[++offset] = (byte) ((value >> 8) & 0xFF); dst[++offset] = (byte) (value & 0xFF); return 4; |
byte[] | toByteByAddress(String address) to Byte By Address if (address == null) { throw new IllegalArgumentException("address is invalid"); String[] ips = address.split("[.:_]"); if (ips.length < 4) { throw new IllegalArgumentException("broker is invalid"); int pos = 0; ... |
byte[] | toByteByHex(String address) to Byte By Hex if (address == null) { throw new IllegalArgumentException("address is invalid"); int len = address.length(); if (len < 8) { throw new IllegalArgumentException("address is invalid"); byte[] buf; ... |
byte | toByteColor(int i) integer color to byte color. return (byte) ((i >>> 0) & 0xFF); |