public HeapIndexInput(HeapDirectory dir, HeapRamFile file) throws IOException { this.bufferSize = dir.bufferSizeInBytes(); this.file = file; length = file.length(); if (length / dir.bufferSizeInBytes() >= Integer.MAX_VALUE) { throw new IOException("Too large RAMFile! " + length); } // make sure that we switch to the // first needed buffer lazily currentBufferIndex = -1; currentBuffer = null; }