See the API for CharBuffer and its parent class Buffer. Buffer's have positions, so for instance the length method of CharBuffer states:

If you've read in data, the position has changed to the...