Java Code Examples for org.apache.qpid.proton.amqp.UnsignedLong#longValue()

The following examples show how to use org.apache.qpid.proton.amqp.UnsignedLong#longValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnsignedLongType.java    From qpid-proton-j with Apache License 2.0 6 votes vote down vote up
public void fastWrite(EncoderImpl encoder, UnsignedLong value)
{
    long longValue = value.longValue();
    if (longValue == 0)
    {
        encoder.writeRaw(EncodingCodes.ULONG0);
    }
    else if (longValue > 0 && longValue <= 255)
    {
        encoder.writeRaw(EncodingCodes.SMALLULONG);
        encoder.writeRaw((byte)longValue);
    }
    else
    {
        encoder.writeRaw(EncodingCodes.ULONG);
        encoder.writeRaw(longValue);
    }
}
 
Example 2
Source File: UnsignedLongType.java    From qpid-proton-j with Apache License 2.0 5 votes vote down vote up
public UnsignedLongEncoding getEncoding(final UnsignedLong val)
{
    long l = val.longValue();
    return l == 0L
        ? _zeroUnsignedLongEncoding
        : (l >= 0 && l <= 255L) ? _smallUnsignedLongEncoding : _unsignedLongEncoding;
}