private byte[] fill(final byte[] data, int dataOffset, final int len)
            throws IOException
    {
        final int existing = limit - offset;
        int toRead = len - existing, read = 0;
        if (existing != 0)
        {
            // copy existing
            System.arraycopy(buffer, offset, data, dataOffset, existing);
            dataOffset += existing;
        }
        // reset
        offset = 0;
        limit = 0;

        do
        {
            read = in.read(data, dataOffset, toRead);
            if (read == -1)
                throw new ProtostuffException("Truncated message.");

            dataOffset += read;
            toRead -= read;
        } while (toRead > 0);

        return data;
    }
Returns true if there are {@code minimum} bytes available for reading.
<p>
The caller is responsible that the arg {@code minimum} is not larger than the buffer size.
protostuff-kvp/src/main/java/io/protostuff/KvpInput.java