/** * @deprecated Please use new utility class HexUtil * @see HexUtil#toHexString(byte[], int, int) */ @Deprecated public static String toHexString(byte[] bytes, int offset, int length) { return HexUtil.toHexString(bytes, offset, length); }
/** * @deprecated Please use new utility class HexUtil * @see HexUtil#toHexString(byte[]) */ @Deprecated public static String toHexString(byte[] bytes) { return HexUtil.toHexString(bytes); }
/** * @deprecated Please use new utility class HexUtil * @see HexUtil#toHexString(byte[]) */ @Deprecated public static String toHexString(byte[] bytes) { return HexUtil.toHexString(bytes); }
@Override public String toString() { StringBuilder buffer = new StringBuilder(40); buffer.append("0x"); buffer.append(HexUtil.toHexString(this.ton)); buffer.append(" 0x"); buffer.append(HexUtil.toHexString(this.npi)); buffer.append(" ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.address)); buffer.append("]"); return buffer.toString(); } }
@Override public void appendBodyToString(StringBuilder buffer) { buffer.append("(messageId ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.messageId)); buffer.append("] finalDate ["); buffer.append(StringUtil.toStringWithNullAsEmpty(this.finalDate)); buffer.append("] messageState [0x"); buffer.append(HexUtil.toHexString(this.messageState)); buffer.append("] errorCode [0x"); buffer.append(HexUtil.toHexString(this.errorCode)); buffer.append("])"); } }
private static HexString createHexString(byte[] bytes) { // though method is private, leaving checks in place to show intent if (bytes == null) { throw new IllegalArgumentException("bytes argument cannot be null; use HexString.NULL instead"); } else if (bytes.length == 0) { throw new IllegalArgumentException("bytes argument cannot be zero length; use HexString.NULL instead"); } byte[] copyOfbytes = copyByteArray(bytes); String hex = toHexString(copyOfbytes).toUpperCase(); return new HexString(copyOfbytes, hex); }
@Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { logger.info("Received new throwable on channel 0x" + HexUtil.toHexString(channel.getId()) ); this.exceptionQueue.add(e.getCause()); }
static public String buildErrorMessage(PduResponse responsePdu) { return "Unexpected response PDU [" + responsePdu.getClass().getName() + "] [error: 0x" + HexUtil.toHexString(responsePdu.getCommandStatus()) + " \"" + responsePdu.getResultMessage() + "\"]"; } }
static public String buildErrorMessage(BaseBindResp bindResponse) { if (bindResponse == null) { return "Bind request failed (response was null)"; } else { return "Unable to bind [error: 0x" + HexUtil.toHexString(bindResponse.getCommandStatus()) + " \"" + bindResponse.getResultMessage() + "\"]"; } }
public void sendPdu(Pdu pdu) throws Exception { logger.info("Sending on channel 0x" + HexUtil.toHexString(channel.getId()) + " PDU: {}", pdu); ChannelBuffer writeBuffer = this.transcoder.encode(pdu); channel.write(writeBuffer).await(); }
@Override public byte[] doGetRecord(byte[] key) throws RecordNotFoundException, DataStoreFatalException { byte[] value = bdb.get(key); if (value == null) { throw new RecordNotFoundException("The record for key [0x" + HexUtil.toHexString(key) + "] was not found"); } return value; }
public void sendPdu(Pdu pdu) throws Exception { logger.info("Sending on channel 0x" + HexUtil.toHexString(channel.getId()) + " PDU: {}", pdu); ChannelBuffer writeBuffer = this.transcoder.encode(pdu); channel.write(writeBuffer).await(); }
static public String buildErrorMessage(BaseBindResp bindResponse) { if (bindResponse == null) { return "Bind request failed (response was null)"; } else { return "Unable to bind [error: 0x" + HexUtil.toHexString(bindResponse.getCommandStatus()) + " \"" + bindResponse.getResultMessage() + "\"]"; } }
public void sendPdu(Pdu pdu) throws Exception { logger.info("Sending on channel 0x" + HexUtil.toHexString(channel.getId()) + " PDU: {}", pdu); ChannelBuffer writeBuffer = this.transcoder.encode(pdu); channel.write(writeBuffer).await(); }
public void sendPdu(Pdu pdu) throws Exception { logger.info("Sending on channel 0x" + HexUtil.toHexString(channel.getId()) + " PDU: {}", pdu); ChannelBuffer writeBuffer = this.transcoder.encode(pdu); channel.write(writeBuffer).await(); }
static public String buildErrorMessage(BaseBindResp bindResponse) { if (bindResponse == null) { return "Bind request failed (response was null)"; } else { return "Unable to bind [error: 0x" + HexUtil.toHexString(bindResponse.getCommandStatus()) + " \"" + bindResponse.getResultMessage() + "\"]"; } }
static public String buildErrorMessage(BaseBindResp bindResponse) { if (bindResponse == null) { return "Bind request failed (response was null)"; } else { return "Unable to bind [error: 0x" + HexUtil.toHexString(bindResponse.getCommandStatus()) + " \"" + bindResponse.getResultMessage() + "\"]"; } }
static public String buildErrorMessage(GenericNack nack) { return "Negative acknowledgement for request [error: 0x" + HexUtil.toHexString(nack.getCommandStatus()) + " \"" + nack.getResultMessage() + "\"]"; } }
@Override public byte[] doGetRecord(byte[] key) throws RecordNotFoundException, DataStoreFatalException { byte[] value = db.get(key); Error error = db.error(); if (error != null && error.code() != 0) logger.trace("Error on get {} {} {}", HexUtil.toHexString(key), error.code(), error); if (value == null) { throw new RecordNotFoundException("The record for key [0x" + HexUtil.toHexString(key) + "] was not found"); } return value; }
@Override public void doSetRecord(byte[] key, byte[] value) throws DataStoreFatalException { try { if (this.synchronizeInterval == 0) { db.put(key, value, new WriteOptions().sync(true)); } else { db.put(key, value, new WriteOptions().sync(false)); } } catch (DBException e) { throw new DataStoreFatalException("Unable to set value and key [0x" + HexUtil.toHexString(key) + "] [message=" + e.getMessage() + "]", e); } }