// 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 */
   }
 }