/** * Appends 16 characters to a StringBuilder with the long in a "Big Endian" * hexidecimal format. For example, a long 0xAABBCCDDEE123456 will be appended as a * String in format "AABBCCDDEE123456". A long of value 0 will be appended as "0000000000000000". * @param buffer The StringBuilder the long value in hexidecimal format * will be appended to. If the buffer is null, this method will throw * a NullPointerException. * @param value The long value that will be converted to a hexidecimal String. */ static public void appendHexString(StringBuilder buffer, long value) { appendHexString(buffer, (int)((value & 0xFFFFFFFF00000000L) >>> 32)); appendHexString(buffer, (int)(value & 0x00000000FFFFFFFFL)); }
/** * Appends 16 characters to a StringBuilder with the long in a "Big Endian" * hexidecimal format. For example, a long 0xAABBCCDDEE123456 will be appended as a * String in format "AABBCCDDEE123456". A long of value 0 will be appended as "0000000000000000". * @param buffer The StringBuilder the long value in hexidecimal format * will be appended to. If the buffer is null, this method will throw * a NullPointerException. * @param value The long value that will be converted to a hexidecimal String. */ static public void appendHexString(StringBuilder buffer, long value) { appendHexString(buffer, (int)((value & 0xFFFFFFFF00000000L) >>> 32)); appendHexString(buffer, (int)(value & 0x00000000FFFFFFFFL)); }
/** * Creates an 8 character hex String from an int twith the int in a "Big Endian" * hexidecimal format. For example, an int 0xFFAA1234 will be returned as a * String in format "FFAA1234". A int of value 0 will be returned as "00000000". * @param value The int value that will be converted to a hexidecimal String. */ static public String toHexString(int value) { StringBuilder buffer = new StringBuilder(8); appendHexString(buffer, value); return buffer.toString(); }
/** * Creates an 8 character hex String from an int twith the int in a "Big Endian" * hexidecimal format. For example, an int 0xFFAA1234 will be returned as a * String in format "FFAA1234". A int of value 0 will be returned as "00000000". * @param value The int value that will be converted to a hexidecimal String. */ static public String toHexString(int value) { StringBuilder buffer = new StringBuilder(8); appendHexString(buffer, value); return buffer.toString(); }
/** * Creates a 16 character hex String from a long with the long in a "Big Endian" * hexidecimal format. For example, a long 0xAABBCCDDEE123456 will be returned as a * String in format "AABBCCDDEE123456". A long of value 0 will be returned as "0000000000000000". * @param value The long value that will be converted to a hexidecimal String. */ static public String toHexString(long value) { StringBuilder buffer = new StringBuilder(16); appendHexString(buffer, value); return buffer.toString(); }
/** * Creates a 2 character hex String from a byte with the byte in a "Big Endian" * hexidecimal format. For example, a byte 0x34 will be returned as a * String in format "34". A byte of value 0 will be returned as "00". * @param value The byte value that will be converted to a hexidecimal String. */ static public String toHexString(byte value) { StringBuilder buffer = new StringBuilder(2); appendHexString(buffer, value); return buffer.toString(); }
/** * Creates a 2 character hex String from a byte with the byte in a "Big Endian" * hexidecimal format. For example, a byte 0x34 will be returned as a * String in format "34". A byte of value 0 will be returned as "00". * @param value The byte value that will be converted to a hexidecimal String. */ static public String toHexString(byte value) { StringBuilder buffer = new StringBuilder(2); appendHexString(buffer, value); return buffer.toString(); }
/** * Creates a 4 character hex String from a short with the short in a "Big Endian" * hexidecimal format. For example, a short 0x1234 will be returned as a * String in format "1234". A short of value 0 will be returned as "0000". * @param value The short value that will be converted to a hexidecimal String. */ static public String toHexString(short value) { StringBuilder buffer = new StringBuilder(4); appendHexString(buffer, value); return buffer.toString(); }
/** * Creates a 4 character hex String from a short with the short in a "Big Endian" * hexidecimal format. For example, a short 0x1234 will be returned as a * String in format "1234". A short of value 0 will be returned as "0000". * @param value The short value that will be converted to a hexidecimal String. */ static public String toHexString(short value) { StringBuilder buffer = new StringBuilder(4); appendHexString(buffer, value); return buffer.toString(); }
/** * Creates a 16 character hex String from a long with the long in a "Big Endian" * hexidecimal format. For example, a long 0xAABBCCDDEE123456 will be returned as a * String in format "AABBCCDDEE123456". A long of value 0 will be returned as "0000000000000000". * @param value The long value that will be converted to a hexidecimal String. */ static public String toHexString(long value) { StringBuilder buffer = new StringBuilder(16); appendHexString(buffer, value); return buffer.toString(); }
/** * Appends a byte array to a StringBuilder with each byte in a "Big Endian" * hexidecimal format. For example, a byte 0x34 will be appended as a * String in format "34". A byte array of { 0x34, 035 } would append "3435". * @param buffer The StringBuilder the byte array in hexidecimal format * will be appended to. If the buffer is null, this method will throw * a NullPointerException. * @param bytes The byte array that will be converted to a hexidecimal String. * If the byte array is null, this method will append nothing (a noop) */ public static void appendHexString(StringBuilder buffer, byte[] bytes) { assertNotNull(buffer); if (bytes == null) { return; // do nothing (a noop) } appendHexString(buffer, bytes, 0, bytes.length); }
/** * Appends a byte array to a StringBuilder with each byte in a "Big Endian" * hexidecimal format. For example, a byte 0x34 will be appended as a * String in format "34". A byte array of { 0x34, 035 } would append "3435". * @param buffer The StringBuilder the byte array in hexidecimal format * will be appended to. If the buffer is null, this method will throw * a NullPointerException. * @param bytes The byte array that will be converted to a hexidecimal String. * If the byte array is null, this method will append nothing (a noop) */ public static void appendHexString(StringBuilder buffer, byte[] bytes) { assertNotNull(buffer); if (bytes == null) { return; // do nothing (a noop) } appendHexString(buffer, bytes, 0, bytes.length); }
@Override public String toString() { StringBuilder buffer = new StringBuilder(40); if (tagName != null) { buffer.append(this.tagName); } else { buffer.append("tlv"); } buffer.append(": 0x"); buffer.append(HexUtil.toHexString(this.tag)); buffer.append(" 0x"); buffer.append(HexUtil.toHexString((short)getUnsignedLength())); buffer.append(" ["); HexUtil.appendHexString(buffer, this.value); buffer.append("]"); return buffer.toString(); }
@Override public String toString() { StringBuilder buffer = new StringBuilder(40); if (tagName != null) { buffer.append(this.tagName); } else { buffer.append("tlv"); } buffer.append(": 0x"); buffer.append(HexUtil.toHexString(this.tag)); buffer.append(" 0x"); buffer.append(HexUtil.toHexString((short)getUnsignedLength())); buffer.append(" ["); HexUtil.appendHexString(buffer, this.value); buffer.append("]"); return buffer.toString(); }
@Override public String toString() { StringBuilder buffer = new StringBuilder(40); if (tagName != null) { buffer.append(this.tagName); } else { buffer.append("tlv"); } buffer.append(": 0x"); buffer.append(HexUtil.toHexString(this.tag)); buffer.append(" 0x"); buffer.append(HexUtil.toHexString((short)getUnsignedLength())); buffer.append(" ["); HexUtil.appendHexString(buffer, this.value); buffer.append("]"); return buffer.toString(); }
@Override public void appendBodyToString(StringBuilder buffer) { buffer.append("( messageId ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.messageId)); buffer.append("] sourceAddr ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.sourceAddress)); buffer.append("] scheduleDeliveryTime ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.scheduleDeliveryTime)); buffer.append("] validityPeriod ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.validityPeriod)); buffer.append("] regDlvry [0x"); buffer.append(HexUtil.toHexString(this.registeredDelivery)); buffer.append("] message ["); HexUtil.appendHexString(buffer, this.shortMessage); buffer.append("])"); }
@Override public String toString() { StringBuilder buffer = new StringBuilder(40); if (tagName != null) { buffer.append(this.tagName); } else { buffer.append("tlv"); } buffer.append(": 0x"); buffer.append(HexUtil.toHexString(this.tag)); buffer.append(" 0x"); buffer.append(HexUtil.toHexString((short)getUnsignedLength())); buffer.append(" ["); HexUtil.appendHexString(buffer, this.value); buffer.append("]"); return buffer.toString(); }
@Override public void appendBodyToString(StringBuilder buffer) { buffer.append("( messageId ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.messageId)); buffer.append("] sourceAddr ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.sourceAddress)); buffer.append("] scheduleDeliveryTime ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.scheduleDeliveryTime)); buffer.append("] validityPeriod ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.validityPeriod)); buffer.append("] regDlvry [0x"); buffer.append(HexUtil.toHexString(this.registeredDelivery)); buffer.append("] message ["); HexUtil.appendHexString(buffer, this.shortMessage); buffer.append("])"); }
@Override public void appendBodyToString(StringBuilder buffer) { buffer.append("( messageId ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.messageId)); buffer.append("] sourceAddr ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.sourceAddress)); buffer.append("] scheduleDeliveryTime ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.scheduleDeliveryTime)); buffer.append("] validityPeriod ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.validityPeriod)); buffer.append("] regDlvry [0x"); buffer.append(HexUtil.toHexString(this.registeredDelivery)); buffer.append("] message ["); HexUtil.appendHexString(buffer, this.shortMessage); buffer.append("])"); }
@Override public void appendBodyToString(StringBuilder buffer) { buffer.append("( messageId ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.messageId)); buffer.append("] sourceAddr ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.sourceAddress)); buffer.append("] scheduleDeliveryTime ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.scheduleDeliveryTime)); buffer.append("] validityPeriod ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.validityPeriod)); buffer.append("] regDlvry [0x"); buffer.append(HexUtil.toHexString(this.registeredDelivery)); buffer.append("] message ["); HexUtil.appendHexString(buffer, this.shortMessage); buffer.append("])"); }