Example #1
0
 /// <returns>
 /// finalized form </returns>
 public virtual PrefixCodedTerms Finish()
 {
     try
     {
         output.Dispose();
         return(new PrefixCodedTerms(buffer));
     }
     catch (IOException e)
     {
         throw new Exception(e.ToString(), e);
     }
 }
Example #2
0
 /// <summary>
 /// return finalized form </summary>
 public virtual PrefixCodedTerms Finish()
 {
     try
     {
         Output.Dispose();
         return(new PrefixCodedTerms(Buffer));
     }
     catch (IOException e)
     {
         throw new Exception(e.Message, e);
     }
 }
Example #3
0
 /// <returns>
 /// finalized form </returns>
 public virtual PrefixCodedTerms Finish()
 {
     try
     {
         output.Dispose();
         return(new PrefixCodedTerms(buffer));
     }
     catch (Exception e) when(e.IsIOException())
     {
         throw RuntimeException.Create(e);
     }
 }
Example #4
0
        private bool disposed = false; // LUCENENET specific
        protected override void Dispose(bool disposing)
        {
            if (disposing && !disposed)
            {
                disposed = true;
                _wrappedPostingsWriter.Dispose();
                _buffer.Dispose(); // LUCENENET specific

                if (_wrappedPostingsWriter is PulsingPostingsWriter ||
                    VERSION_CURRENT < VERSION_META_ARRAY)
                {
                    return;
                }

                var summaryFileName = IndexFileNames.SegmentFileName(_segmentState.SegmentInfo.Name,
                                                                     _segmentState.SegmentSuffix, SUMMARY_EXTENSION);
                IndexOutput output = null;
                try
                {
                    output =
                        _segmentState.Directory.CreateOutput(summaryFileName, _segmentState.Context);
                    CodecUtil.WriteHeader(output, CODEC, VERSION_CURRENT);
                    output.WriteVInt32(_fields.Count);
                    foreach (var field in _fields)
                    {
                        output.WriteVInt32(field.FieldNumber);
                        output.WriteVInt32(field.Int64sSize);
                    }
                    output.Dispose();
                }
                finally
                {
                    IOUtils.DisposeWhileHandlingException(output);
                }
            }
        }