Java Code Examples for org.apache.qpid.proton.amqp.Symbol#length()

The following examples show how to use org.apache.qpid.proton.amqp.Symbol#length() . 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: SymbolType.java    From qpid-proton-j with Apache License 2.0 6 votes vote down vote up
public void fastWrite(EncoderImpl encoder, Symbol symbol)
{
    if (symbol.length() <= 255)
    {
        // Reserve size of body + type encoding and single byte size
        encoder.getBuffer().ensureRemaining(2 + symbol.length());
        encoder.writeRaw(EncodingCodes.SYM8);
        encoder.writeRaw((byte) symbol.length());
        symbol.writeTo(encoder.getBuffer());
    }
    else
    {
        // Reserve size of body + type encoding and four byte size
        encoder.getBuffer().ensureRemaining(5 + symbol.length());
        encoder.writeRaw(EncodingCodes.SYM32);
        encoder.writeRaw(symbol.length());
        symbol.writeTo(encoder.getBuffer());
    }
}
 
Example 2
Source File: SymbolType.java    From qpid-proton-j with Apache License 2.0 4 votes vote down vote up
@Override
public SymbolEncoding getEncoding(final Symbol val)
{
    return val.length() <= 255 ? _shortSymbolEncoding : _symbolEncoding;
}
 
Example 3
Source File: SymbolType.java    From qpid-proton-j with Apache License 2.0 4 votes vote down vote up
@Override
protected int getEncodedValueSize(final Symbol val)
{
    return val.length();
}
 
Example 4
Source File: SymbolType.java    From qpid-proton-j with Apache License 2.0 4 votes vote down vote up
@Override
protected int getEncodedValueSize(final Symbol val)
{
    return val.length();
}