private void CheckReadBytes(IndexInput input, int size, int pos) { // Just to see that "offset" is treated properly in readBytes(), we // add an arbitrary offset at the beginning of the array int offset = size % 10; // arbitrary buffer = ArrayUtil.Grow(buffer, offset + size); Assert.AreEqual(pos, input.GetFilePointer()); long left = TEST_FILE_LENGTH - input.GetFilePointer(); if (left <= 0) { return ; } else if (left < size) { size = (int) left; } input.ReadBytes(buffer, offset, size); Assert.AreEqual(pos + size, input.GetFilePointer()); for (int i = 0; i < size; i++) { Assert.AreEqual(Byten(pos + i), buffer[offset + i], "pos=" + i + " filepos=" + (pos + i)); } }