All Downloads are FREE. Search and download functionalities are using the official Maven repository.

b3.entrypoint.fixp.sbe.FramingHeaderDecoder Maven / Gradle / Ivy

/* Generated SBE (Simple Binary Encoding) message codec. */
package b3.entrypoint.fixp.sbe;

import org.agrona.DirectBuffer;
import org.agrona.sbe.*;


/**
 * Compact Simple Open Framing Header: length in uint16 instead of uint32.
 */
@SuppressWarnings("all")
public final class FramingHeaderDecoder implements CompositeDecoderFlyweight
{
    public static final int SCHEMA_ID = 1;
    public static final int SCHEMA_VERSION = 5;
    public static final int ENCODED_LENGTH = 4;
    public static final java.nio.ByteOrder BYTE_ORDER = java.nio.ByteOrder.LITTLE_ENDIAN;

    private int offset;
    private DirectBuffer buffer;

    public FramingHeaderDecoder wrap(final DirectBuffer buffer, final int offset)
    {
        if (buffer != this.buffer)
        {
            this.buffer = buffer;
        }
        this.offset = offset;

        return this;
    }

    public DirectBuffer buffer()
    {
        return buffer;
    }

    public int offset()
    {
        return offset;
    }

    public int encodedLength()
    {
        return ENCODED_LENGTH;
    }

    public int sbeSchemaId()
    {
        return SCHEMA_ID;
    }

    public int sbeSchemaVersion()
    {
        return SCHEMA_VERSION;
    }

    public static int messageLengthEncodingOffset()
    {
        return 0;
    }

    public static int messageLengthEncodingLength()
    {
        return 2;
    }

    public static int messageLengthSinceVersion()
    {
        return 0;
    }

    public static int messageLengthNullValue()
    {
        return 65535;
    }

    public static int messageLengthMinValue()
    {
        return 12;
    }

    public static int messageLengthMaxValue()
    {
        return 2048;
    }

    public int messageLength()
    {
        return (buffer.getShort(offset + 0, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF);
    }


    public static int encodingTypeEncodingOffset()
    {
        return 2;
    }

    public static int encodingTypeEncodingLength()
    {
        return 2;
    }

    public static int encodingTypeSinceVersion()
    {
        return 0;
    }

    public static int encodingTypeNullValue()
    {
        return 65535;
    }

    public static int encodingTypeMinValue()
    {
        return 0;
    }

    public static int encodingTypeMaxValue()
    {
        return 65534;
    }

    public int encodingType()
    {
        return (buffer.getShort(offset + 2, java.nio.ByteOrder.LITTLE_ENDIAN) & 0xFFFF);
    }


    public String toString()
    {
        if (null == buffer)
        {
            return "";
        }

        return appendTo(new StringBuilder()).toString();
    }

    public StringBuilder appendTo(final StringBuilder builder)
    {
        if (null == buffer)
        {
            return builder;
        }

        builder.append('(');
        builder.append("messageLength=");
        builder.append(this.messageLength());
        builder.append('|');
        builder.append("encodingType=");
        builder.append(this.encodingType());
        builder.append(')');

        return builder;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy