public virtual void TestEOF()
{
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);
Assert.Fail("Block read past end of file");
}
catch (IOException e)
{
/* success */
}
input.Seek(pos);
try
{
CheckReadBytes(input, 50, pos);
Assert.Fail("Block read past end of file");
}
catch (IOException e)
{
/* success */
}
input.Seek(pos);
try
{
CheckReadBytes(input, 100000, pos);
Assert.Fail("Block read past end of file");
}
catch (IOException e)
{
/* success */
}
}