public MultiMMapIndexInput(MMapDirectory enclosingInstance, System.IO.FileStream raf, int maxBufSize)
{
InitBlock(enclosingInstance);
this.length = raf.Length;
this.maxBufSize = maxBufSize;
if (maxBufSize <= 0)
throw new System.ArgumentException("Non positive maxBufSize: " + maxBufSize);
if ((length / maxBufSize) > System.Int32.MaxValue)
{
throw new System.ArgumentException("RandomAccessFile too big for maximum buffer size: " + raf.ToString());
}
int nrBuffers = (int) (length / maxBufSize);
if (((long) nrBuffers * maxBufSize) < length)
nrBuffers++;
this.buffers = new System.IO.MemoryStream[nrBuffers];
this.bufSizes = new int[nrBuffers];
long bufferStart = 0;
System.IO.FileStream rafc = raf;
for (int bufNr = 0; bufNr < nrBuffers; bufNr++)
{
byte[] data = new byte[rafc.Length];
raf.Read(data, 0, (int) rafc.Length);
int bufSize = (length > (bufferStart + maxBufSize))?maxBufSize:(int) (length - bufferStart);
this.buffers[bufNr] = new System.IO.MemoryStream(data);
this.bufSizes[bufNr] = bufSize;
bufferStart += bufSize;
}
Seek(0L);
}