class OneByteSizeReady implements Step
    {
        @Override
        public Step.Result apply()
        {
            return oneByteSizeReady();
        }
    }

    protected final long maxmsgsize;

    // the message decoded so far
    protected Msg inProgress;

    protected final Step oneByteSizeReady   = new OneByteSizeReady();
    protected final Step eightByteSizeReady = new EightByteSizeReady();
    protected final Step flagsReady         = new FlagsReady();
    protected final Step messageReady       = new MessageReady();

    private final MsgAllocator allocator;

    public Decoder(Errno errno, int bufsize, long maxmsgsize, MsgAllocator allocator)
    {
        super(errno, bufsize);
        this.maxmsgsize = maxmsgsize;
        this.allocator = allocator;
    }

    protected final Step.Result sizeReady(final long size)
    {<FILL_FUNCTION_BODY>

        //  Message size must not exceed the maximum allowed size.
        if (maxmsgsize >= 0) {
            if (size > maxmsgsize) {
                errno(ZError.EMSGSIZE);
                return Step.Result.ERROR;
            }
        }

        //  Message size must fit within range of size_t data type.
        if (size > Integer.MAX_VALUE) {
            errno(ZError.EMSGSIZE);
            return Step.Result.ERROR;
        }

        //  inProgress is initialized at this point so in theory we should
        //  close it before calling init_size, however, it's a 0-byte
        //  message and thus we can treat it as uninitialized.
        inProgress = allocate((int) size);

        return Step.Result.MORE_DATA;
    
<methods>public void <init>(zmq.util.Errno, int) ,public zmq.io.coder.IDecoder.Step.Result decode(java.nio.ByteBuffer, int, ValueReference<java.lang.Integer>) ,public void destroy() ,public int errno() ,public java.nio.ByteBuffer getBuffer() <variables>private final non-sealed java.nio.ByteBuffer buf,private final non-sealed int bufsize,private final non-sealed zmq.util.Errno errno,private zmq.io.coder.IDecoder.Step next,private java.nio.ByteBuffer readPos,private int toRead,private boolean zeroCopy