List of usage examples for io.netty.buffer ByteBufUtil hexDump
public static String hexDump(byte[] array)
From source file:org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser.java
License:Open Source License
protected final void serializeTlv(final Tlv tlv, final ByteBuf buffer) { Preconditions.checkNotNull(tlv, "PCEP TLV is mandatory."); LOG.trace("Serializing PCEP TLV {}", tlv); this.tlvReg.serializeTlv(tlv, buffer); LOG.trace("Serialized PCEP TLV : {}.", ByteBufUtil.hexDump(buffer)); }
From source file:org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser.java
License:Open Source License
protected final void serializeVendorInformationTlvs(final List<VendorInformationTlv> tlvs, final ByteBuf buffer) { if (tlvs != null) { for (final VendorInformationTlv tlv : tlvs) { LOG.trace("Serializing VENDOR-INFORMATION TLV {}", tlv); this.viTlvReg.serializeVendorInformationTlv(tlv, buffer); LOG.trace("Serialized VENDOR-INFORMATION TLV : {}.", ByteBufUtil.hexDump(buffer)); }/*from w ww . j a va 2 s . c om*/ } }
From source file:org.opendaylight.protocol.rsvp.parser.spi.subobjects.EROSubobjectListParser.java
License:Open Source License
public List<SubobjectContainer> parseList(final ByteBuf buffer) throws RSVPParsingException { // Explicit approval of empty ERO Preconditions.checkArgument(buffer != null, "Array of bytes is mandatory. Can't be null."); final List<SubobjectContainer> subs = new ArrayList<>(); while (buffer.isReadable()) { final boolean loose = ((buffer.getUnsignedByte(buffer.readerIndex()) & (1 << Values.FIRST_BIT_OFFSET)) != 0) ? true : false; final int type = (buffer.readUnsignedByte() & Values.BYTE_MAX_VALUE_BYTES) & ~(1 << Values.FIRST_BIT_OFFSET); final int length = buffer.readUnsignedByte() - HEADER_LENGTH; if (length > buffer.readableBytes()) { throw new RSVPParsingException( "Wrong length specified. Passed: " + length + "; Expected: <= " + buffer.readableBytes()); }/*from ww w .j a v a 2s . c om*/ LOG.debug("Attempt to parse subobject from bytes: {}", ByteBufUtil.hexDump(buffer)); final SubobjectContainer sub = this.subobjReg.parseSubobject(type, buffer.readSlice(length), loose); if (sub == null) { LOG.warn("Unknown subobject type: {}. Ignoring subobject.", type); } else { LOG.debug("Subobject was parsed. {}", sub); subs.add(sub); } } return subs; }
From source file:org.opendaylight.protocol.rsvp.parser.spi.subobjects.RROSubobjectListParser.java
License:Open Source License
public List<SubobjectContainer> parseList(final ByteBuf buffer) throws RSVPParsingException { Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty."); final List<SubobjectContainer> subs = new ArrayList<>(); while (buffer.isReadable()) { final int type = buffer.readUnsignedByte(); final int length = buffer.readUnsignedByte() - HEADER_LENGTH; if (length > buffer.readableBytes()) { throw new RSVPParsingException( "Wrong length specified. Passed: " + length + "; Expected: <= " + buffer.readableBytes()); }/*from w w w .ja v a 2s . com*/ LOG.debug("Attempt to parse subobject from bytes: {}", ByteBufUtil.hexDump(buffer)); final SubobjectContainer sub = this.subobjReg.parseSubobject(type, buffer.readSlice(length)); if (sub == null) { LOG.warn("Unknown subobject type: {}. Ignoring subobject.", type); } else { LOG.debug("Subobject was parsed. {}", sub); subs.add(sub); } } return subs; }
From source file:org.opendaylight.protocol.rsvp.parser.spi.subobjects.XROSubobjectListParser.java
License:Open Source License
public List<SubobjectContainer> parseList(final ByteBuf byteBuf) throws RSVPParsingException { final List<SubobjectContainer> subs = new ArrayList<>(); while (byteBuf.isReadable()) { final boolean mandatory = ((byteBuf.getUnsignedByte(byteBuf.readerIndex()) & (1 << Values.FIRST_BIT_OFFSET)) != 0) ? true : false; final int type = UnsignedBytes.checkedCast( (byteBuf.readUnsignedByte() & Values.BYTE_MAX_VALUE_BYTES) & ~(1 << Values.FIRST_BIT_OFFSET)); final int length = byteBuf.readUnsignedByte() - HEADER_LENGHT; if (length > byteBuf.readableBytes()) { throw new RSVPParsingException( "Wrong length specified. Passed: " + length + "; Expected: <= " + byteBuf.readableBytes()); }// ww w. j a v a 2 s .com LOG.debug("Attempt to parse subobject from bytes: {}", ByteBufUtil.hexDump(byteBuf)); final SubobjectContainer sub = this.subobjReg.parseSubobject(type, byteBuf.readSlice(length), mandatory); if (sub == null) { LOG.warn("Unknown subobject type: {}. Ignoring subobject.", type); } else { LOG.debug("Subobject was parsed. {}", sub); subs.add(sub); } } return subs; }
From source file:org.redisson.BaseRemoteService.java
License:Apache License
protected String generateRequestId() { byte[] id = new byte[16]; // TODO JDK UPGRADE replace to native ThreadLocalRandom ThreadLocalRandom.current().nextBytes(id); return ByteBufUtil.hexDump(id); }
From source file:org.redisson.cache.LocalCacheListener.java
License:Apache License
protected RSemaphore getClearSemaphore(byte[] requestId) { String id = ByteBufUtil.hexDump(requestId); RSemaphore semaphore = new RedissonSemaphore(commandExecutor, name + ":clear:" + id); return semaphore; }
From source file:org.redisson.RedissonNode.java
License:Apache License
private String generateId() { byte[] id = new byte[8]; // TODO JDK UPGRADE replace to native ThreadLocalRandom ThreadLocalRandom.current().nextBytes(id); return ByteBufUtil.hexDump(id); }
From source file:org.redisson.RedissonPermitExpirableSemaphore.java
License:Apache License
protected String generateId() { byte[] id = new byte[16]; // TODO JDK UPGRADE replace to native ThreadLocalRandom ThreadLocalRandom.current().nextBytes(id); return ByteBufUtil.hexDump(id); }
From source file:org.redisson.remote.RequestId.java
License:Apache License
@Override public String toString() { return ByteBufUtil.hexDump(id); }