public <T> int parseFieldNumber(Schema<T> schema) throws IOException
    {
        
        if (leftItems != 0)
        {
            leftItems--;
            return lastNumber;
        }

        if (leftEntries == -1) {
            
            if (!unpacker.hasNext()) {
                return 0;
            }
            
            leftEntries = unpacker.unpackMapHeader();
        }
        
        if (leftEntries == 0)
        {
            return 0;
        }

        leftEntries--;

        int fieldNumber;

        if (numeric)
        {
            fieldNumber = unpacker.unpackInt();
        }
        else
        {
            String name = unpacker.unpackString();
            fieldNumber = schema.getFieldNumber(name);
        }

        if (unpacker.hasNext() && unpacker.getNextFormat().getValueType().isArrayType())
        {

            leftItems = unpacker.unpackArrayHeader();
            lastNumber = fieldNumber;

            if (leftItems == 0)
            {
                return parseFieldNumber(schema);
            }
            else
            {
                leftItems--;
            }

        }

        return fieldNumber;

    }
How many items left to parse in array
protostuff-msgpack/src/main/java/io/protostuff/MsgpackParser.java