// This tests that attempts to readBytes() past an EOF will fail, while
 // reads up to the EOF will succeed. The EOF is determined by the
 // BufferedIndexInput's arbitrary length() value.
 public void testEOF() throws Exception {
   MyBufferedIndexInput input = new MyBufferedIndexInput(1024);
   // see that we can read all the bytes at one go:
   checkReadBytes(input, (int) input.length(), 0);
   // go back and see that we can't read more than that, for small and
   // large overflows:
   int pos = (int) input.length() - 10;
   input.seek(pos);
   checkReadBytes(input, 10, pos);
   input.seek(pos);
   try {
     checkReadBytes(input, 11, pos);
     fail("Block read past end of file");
   } catch (IOException e) {
     /* success */
   }
   input.seek(pos);
   try {
     checkReadBytes(input, 50, pos);
     fail("Block read past end of file");
   } catch (IOException e) {
     /* success */
   }
   input.seek(pos);
   try {
     checkReadBytes(input, 100000, pos);
     fail("Block read past end of file");
   } catch (IOException e) {
     /* success */
   }
 }
 // Call readByte() repeatedly, past the buffer boundary, and see that it
 // is working as expected.
 // Our input comes from a dynamically generated/ "file" - see
 // MyBufferedIndexInput below.
 public void testReadByte() throws Exception {
   MyBufferedIndexInput input = new MyBufferedIndexInput();
   for (int i = 0; i < BufferedIndexInput.BUFFER_SIZE * 10; i++) {
     assertEquals(input.readByte(), byten(i));
   }
 }