static void fillBufferFrom(InputStream in, byte[] buf, int offset, int len)
            throws IOException
    {
        for (int read = 0; len > 0; len -= read, offset += read)
        {
            read = in.read(buf, offset, len);
            if (read == -1)
                throw ProtobufException.truncatedMessage();
        }
    }
Fills the byte buffer from the {@link InputStream} with the specified length.
protostuff-core/src/main/java/io/protostuff/IOUtil.java