Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void close() throws java.io.IOException
        public override void close()
        {
            bool success = false;

            try
            {
                if (meta != null)
                {
                    meta.writeVInt(-1);          // write EOF marker
                    CodecUtil.writeFooter(meta); // write checksum
                }
                if (data != null)
                {
                    CodecUtil.writeFooter(data);
                }
                success = true;
            }
            finally
            {
                if (success)
                {
                    IOUtils.close(data, meta);
                }
                else
                {
                    IOUtils.closeWhileHandlingException(data, meta);
                }
                data = meta = null;
            }
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void close() throws java.io.IOException
            public override void close()
            {
                // EOF marker:
                try
                {
                    @out.writeVInt(0);
                    CodecUtil.writeFooter(@out);
                }
                finally
                {
                    @out.close();
                }
            }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void close() throws java.io.IOException
        public override void close()
        {
            if (blockOut != null)
            {
                IOException ioe = null;
                try
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long blockDirStart = blockOut.getFilePointer();
                    long blockDirStart = blockOut.FilePointer;

                    // write field summary
                    blockOut.writeVInt(fields.Count);
                    foreach (FieldMetaData field in fields)
                    {
                        blockOut.writeVInt(field.fieldInfo.number);
                        blockOut.writeVLong(field.numTerms);
                        if (field.fieldInfo.IndexOptions != IndexOptions.DOCS_ONLY)
                        {
                            blockOut.writeVLong(field.sumTotalTermFreq);
                        }
                        blockOut.writeVLong(field.sumDocFreq);
                        blockOut.writeVInt(field.docCount);
                        blockOut.writeVInt(field.longsSize);
                        blockOut.writeVLong(field.statsOut.FilePointer);
                        blockOut.writeVLong(field.metaLongsOut.FilePointer);
                        blockOut.writeVLong(field.metaBytesOut.FilePointer);

                        field.skipOut.writeTo(blockOut);
                        field.statsOut.writeTo(blockOut);
                        field.metaLongsOut.writeTo(blockOut);
                        field.metaBytesOut.writeTo(blockOut);
                        field.dict.save(indexOut);
                    }
                    writeTrailer(blockOut, blockDirStart);
                    CodecUtil.writeFooter(indexOut);
                    CodecUtil.writeFooter(blockOut);
                }
                catch (IOException ioe2)
                {
                    ioe = ioe2;
                }
                finally
                {
                    IOUtils.closeWhileHandlingException(ioe, blockOut, indexOut, postingsWriter);
                    blockOut = null;
                }
            }
        }