cometd-java/cometd-java-api/cometd-java-api-common/src/main/java/org/cometd/bayeux/BinaryData.java
/**
     * @return the binary chunk as {@code ByteBuffer}
     */
@return the binary chunk as  ByteBuffer
@return the binary chunk as ByteBuffer
public ByteBuffer asByteBuffer() {
        Object data = get(DATA);
        if (data instanceof ByteBuffer) {
            return ((ByteBuffer)data).slice();
        } else if (data instanceof byte[]) {
            return ByteBuffer.wrap((byte[])data);
        } else {
            throw new IllegalArgumentException("Cannot convert to ByteBuffer: " + data);
        }
    }
public ByteBuffer asByteBuffer ( ) { Object data = get ( DATA ) ; if ( data instanceof ByteBuffer ) { return ( ( ByteBuffer ) data ) . slice ( ) ; } else if ( data instanceof byte [ ] ) { return ByteBuffer . wrap ( ( byte [ ] ) data ) ; } else { throw new IllegalArgumentException ( "Cannot convert to ByteBuffer: " + data ) ; } }
@return the binary chunk as {@code ByteBuffer}
@return the binary chunk as { @code ByteBuffer }