public static <T> int mergeDelimitedFrom(DataInput in, T message, Schema<T> schema)
            throws IOException
    {
        final byte size = in.readByte();
        final int len = 0 == (size & 0x80) ? size : CodedInput.readRawVarint32(in, size);

        if (len < 0)
            throw ProtobufException.negativeSize();

        if (len != 0)
        {
            // not an empty message
            if (len > CodedInput.DEFAULT_BUFFER_SIZE && in instanceof InputStream)
            {
                // message too big
                final CodedInput input = new CodedInput(new LimitedInputStream((InputStream) in, len),
                        true);
                final GraphCodedInput graphInput = new GraphCodedInput(input);
                schema.mergeFrom(graphInput, message);
                input.checkLastTagWas(0);
            }
            else
            {
                final byte[] buf = new byte[len];
                in.readFully(buf, 0, len);
                final ByteArrayInput input = new ByteArrayInput(buf, 0, len,
                        true);
                final GraphByteArrayInput graphInput = new GraphByteArrayInput(input);
                try
                {
                    schema.mergeFrom(graphInput, message);
                }
                catch (ArrayIndexOutOfBoundsException e)
                {
                    throw ProtobufException.truncatedMessage(e);
                }
                input.checkLastTagWas(0);
            }
        }

        // check it since this message is embedded in the DataInput.
        if (!schema.isInitialized(message))
            throw new UninitializedMessageException(message, schema);

        return len;
    }
Used by the code generated messages that implement {@link java.io.Externalizable}. Merges from the
{@link DataInput}.

@return the size of the message
protostuff-core/src/main/java/io/protostuff/GraphIOUtil.java