Example #1
0
            internal MMapIndexInput(MMapDirectory enclosingInstance, System.IO.FileStream raf)
            {
                byte[] data = new byte[raf.Length];
                raf.Read(data, 0, (int)raf.Length);

                InitBlock(enclosingInstance);
                this.length = raf.Length;
                this.buffer = new System.IO.MemoryStream(data);
            }
Example #2
0
            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);
            }
Example #3
0
			private void  InitBlock(byte[] buffer, MMapDirectory enclosingInstance)
			{
				this.buffer = buffer;
				this.enclosingInstance = enclosingInstance;
			}
Example #4
0
			public AnonymousClassPrivilegedExceptionAction(byte[] buffer, MMapDirectory enclosingInstance)
			{
				InitBlock(buffer, enclosingInstance);
			}
Example #5
0
			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);
			}
Example #6
0
			private void  InitBlock(MMapDirectory enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
Example #7
0
			internal MMapIndexInput(MMapDirectory enclosingInstance, System.IO.FileStream raf)
			{
                byte[] data = new byte[raf.Length];
                raf.Read(data, 0, (int) raf.Length);

				InitBlock(enclosingInstance);
				this.length = raf.Length;
				this.buffer = new System.IO.MemoryStream(data);
			}
Example #8
0
 private void  InitBlock(byte[] buffer, MMapDirectory enclosingInstance)
 {
     this.buffer            = buffer;
     this.enclosingInstance = enclosingInstance;
 }
Example #9
0
 public AnonymousClassPrivilegedExceptionAction(byte[] buffer, MMapDirectory enclosingInstance)
 {
     InitBlock(buffer, enclosingInstance);
 }
Example #10
0
 private void  InitBlock(MMapDirectory enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }