List of usage examples for io.netty.buffer ByteBuf isReadable
public abstract boolean isReadable();
From source file:org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROPathKey32SubobjectParser.java
License:Open Source License
@Override public SubobjectContainer parseSubobject(final ByteBuf buffer, final boolean loose) throws RSVPParsingException { Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty."); if (buffer.readableBytes() != CONTENT_LENGTH) { throw new RSVPParsingException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + "; Expected: >" + CONTENT_LENGTH + "."); }/* w w w . ja va2s.c om*/ final SubobjectContainerBuilder builder = new SubobjectContainerBuilder(); builder.setLoose(loose); builder.setSubobjectType( new PathKeyCaseBuilder().setPathKey(parsePathKey(PCE_ID_F_LENGTH, buffer)).build()); return builder.build(); }