Example usage for io.netty.buffer ByteBuf isReadable

List of usage examples for io.netty.buffer ByteBuf isReadable

Introduction

In this page you can find the example usage for io.netty.buffer ByteBuf isReadable.

Prototype

public abstract boolean isReadable();

Source Link

Document

Returns true if and only if (this.writerIndex - this.readerIndex) is greater than 0 .

Usage

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();
}