public boolean ensureBytes ( int n ) throws IOException { int required = n - endIndex + index ; while ( required > 0 ) { if ( ! readMore ( required ) ) { return false ; } required = n - endIndex + index ; } return true ; }
Ensures that the buffer contains at least n bytes . This method invalidates the buffer and index fields .