read RI from buffer