java: Finish the read code.
Add the max_len.