Esempio n. 1
0
        public override sealed object Clone()
        {
            ByteBufferIndexInput clone = BuildSlice(0L, this.length);

            try
            {
                clone.Seek(GetFilePointer());
            }
            catch (IOException ioe)
            {
                throw new Exception("Should never happen: " + this, ioe);
            }

            return(clone);
        }
Esempio n. 2
0
        public override sealed object Clone()
        {
            ByteBufferIndexInput clone = BuildSlice(0L, this.length);

            try
            {
                clone.Seek(Position); // LUCENENET specific: Renamed from getFilePointer() to match FileStream
            }
            catch (Exception ioe) when(ioe.IsIOException())
            {
                throw RuntimeException.Create("Should never happen: " + this, ioe);
            }

            return(clone);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a slice of this index input, with the given description, offset, and length. The slice is seeked to the beginning.
        /// </summary>
        public ByteBufferIndexInput Slice(string sliceDescription, long offset, long length)
        {
            if (isClone) // well we could, but this is stupid
            {
                throw new InvalidOperationException("cannot slice() " + sliceDescription + " from a cloned IndexInput: " + this);
            }
            ByteBufferIndexInput clone = BuildSlice(offset, length);

            clone.sliceDescription = sliceDescription;
            try
            {
                clone.Seek(0L);
            }
            catch (IOException ioe)
            {
                throw new Exception("Should never happen: " + this, ioe);
            }

            return(clone);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a slice of this index input, with the given description, offset, and length. The slice is seeked to the beginning.
        /// </summary>
        public ByteBufferIndexInput Slice(string sliceDescription, long offset, long length)
        {
            // LUCENENET: Refactored to avoid calls on invalid conditions instead of
            // catching and re-throwing exceptions in the normal workflow.
            EnsureOpen();
            if (isClone) // well we could, but this is stupid
            {
                throw IllegalStateException.Create("cannot Slice() " + sliceDescription + " from a cloned IndexInput: " + this);
            }
            ByteBufferIndexInput clone = BuildSlice(offset, length);

            clone.sliceDescription = sliceDescription;
            try
            {
                clone.Seek(0L);
            }
            catch (Exception ioe) when(ioe.IsIOException())
            {
                throw RuntimeException.Create("Should never happen: " + this, ioe);
            }

            return(clone);
        }