@Override
        public void mergeFrom(Input input, Entry<K, V> message) throws IOException
        {
            // Nobody else calls this except MapSchema.mergeFrom
            final MapWrapper<K, V> wrapper = (MapWrapper<K, V>) message;

            K key = null;
            boolean valueRetrieved = false;
            for (int number = input.readFieldNumber(this);;
            number = input.readFieldNumber(this))
            {
                switch (number)
                {
                    case 0:
                        if (key == null)
                        {
                            // null key (and potentially null value)
                            wrapper.map.put(null, valueRetrieved ? wrapper.value : null);
                        }
                        else if (!valueRetrieved)
                        {
                            // null value
                            wrapper.map.put(key, null);
                        }
                        return;
                    case 1:
                        if (key != null)
                        {
                            throw new ProtostuffException("The map was incorrectly " +
                                    "serialized.");
                        }
                        key = readKeyFrom(input, wrapper);
                        assert key != null;
                        break;
                    case 2:
                        if (valueRetrieved)
                        {
                            throw new ProtostuffException("The map was incorrectly " +
                                    "serialized.");
                        }
                        valueRetrieved = true;

                        putValueFrom(input, wrapper, key);
                        break;
                    default:
                        throw new ProtostuffException("The map was incorrectly " +
                                "serialized.");
                }
            }
        }
The pipe schema of the {@link Map}.
protostuff-collectionschema/src/main/java/io/protostuff/MapSchema.java