blob: 0dbc9a78f7431a3955bafe268ebabd0e2457c677 [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Class CodecUtil
| Apache Lucene.NET 4.8.0-beta00010 Documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class CodecUtil
| Apache Lucene.NET 4.8.0-beta00010 Documentation ">
<meta name="generator" content="docfx 2.56.0.0">
<link rel="shortcut icon" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/favicon.ico">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.css">
<meta property="docfx:navrel" content="toc.html">
<meta property="docfx:tocrel" content="core/toc.html">
<meta property="docfx:rel" content="https://lucenenet.apache.org/docs/4.8.0-beta00009/">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">
<img id="logo" class="svg" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/lucene-net-color.png" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search">
<ul class="level0 breadcrumb">
<li>
<a href="https://lucenenet.apache.org/docs/4.8.0-beta00009/">API</a>
<span id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</span>
</li>
</ul>
</div>
</div>
</header>
<div class="container body-content">
<div id="search-results">
<div class="search-list"></div>
<div class="sr-items">
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
</div>
<ul id="pagination"></ul>
</div>
</div>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Lucene.Net.Codecs.CodecUtil">
<h1 id="Lucene_Net_Codecs_CodecUtil" data-uid="Lucene.Net.Codecs.CodecUtil" class="text-break">Class CodecUtil
</h1>
<div class="markdown level0 summary"><p>Utility class for reading and writing versioned headers.
<p>
Writing codec headers is useful to ensure that a file is in
the format you think it is.
<p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></div>
<div class="markdown level0 conceptual"></div>
<div class="inheritance">
<h5>Inheritance</h5>
<div class="level0"><span class="xref">System.Object</span></div>
<div class="level1"><span class="xref">CodecUtil</span></div>
</div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<span class="xref">System.Object.Equals(System.Object)</span>
</div>
<div>
<span class="xref">System.Object.Equals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.GetHashCode()</span>
</div>
<div>
<span class="xref">System.Object.GetType()</span>
</div>
<div>
<span class="xref">System.Object.MemberwiseClone()</span>
</div>
<div>
<span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.ToString()</span>
</div>
</div>
<h6><strong>Namespace</strong>: <a class="xref" href="Lucene.Net.Codecs.html">Lucene.Net.Codecs</a></h6>
<h6><strong>Assembly</strong>: Lucene.Net.dll</h6>
<h5 id="Lucene_Net_Codecs_CodecUtil_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public sealed class CodecUtil</code></pre>
</div>
<h3 id="fields">Fields
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_CODEC_MAGIC.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.CODEC_MAGIC%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L43">View Source</a>
</span>
<h4 id="Lucene_Net_Codecs_CodecUtil_CODEC_MAGIC" data-uid="Lucene.Net.Codecs.CodecUtil.CODEC_MAGIC">CODEC_MAGIC</h4>
<div class="markdown level1 summary"><p>Constant to identify the start of a codec header.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static readonly int CODEC_MAGIC</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_FOOTER_MAGIC.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.FOOTER_MAGIC%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L48">View Source</a>
</span>
<h4 id="Lucene_Net_Codecs_CodecUtil_FOOTER_MAGIC" data-uid="Lucene.Net.Codecs.CodecUtil.FOOTER_MAGIC">FOOTER_MAGIC</h4>
<div class="markdown level1 summary"><p>Constant to identify the start of a codec footer.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static readonly int FOOTER_MAGIC</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="methods">Methods
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_CheckEOF_Lucene_Net_Store_IndexInput_.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.CheckEOF(Lucene.Net.Store.IndexInput)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L250">View Source</a>
</span>
<a id="Lucene_Net_Codecs_CodecUtil_CheckEOF_" data-uid="Lucene.Net.Codecs.CodecUtil.CheckEOF*"></a>
<h4 id="Lucene_Net_Codecs_CodecUtil_CheckEOF_Lucene_Net_Store_IndexInput_" data-uid="Lucene.Net.Codecs.CodecUtil.CheckEOF(Lucene.Net.Store.IndexInput)">CheckEOF(IndexInput)</h4>
<div class="markdown level1 summary"><p>Checks that the stream is positioned at the end, and throws exception
if it is not. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[Obsolete(&quot;Use CheckFooter(ChecksumIndexInput) instead, this should only used for files without checksums.&quot;)]
public static void CheckEOF(IndexInput in)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.IndexInput.html">IndexInput</a></td>
<td><span class="parametername">in</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_CheckFooter_Lucene_Net_Store_ChecksumIndexInput_.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.CheckFooter(Lucene.Net.Store.ChecksumIndexInput)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L205">View Source</a>
</span>
<a id="Lucene_Net_Codecs_CodecUtil_CheckFooter_" data-uid="Lucene.Net.Codecs.CodecUtil.CheckFooter*"></a>
<h4 id="Lucene_Net_Codecs_CodecUtil_CheckFooter_Lucene_Net_Store_ChecksumIndexInput_" data-uid="Lucene.Net.Codecs.CodecUtil.CheckFooter(Lucene.Net.Store.ChecksumIndexInput)">CheckFooter(ChecksumIndexInput)</h4>
<div class="markdown level1 summary"><p>Validates the codec footer previously written by <a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteFooter_Lucene_Net_Store_IndexOutput_">WriteFooter(IndexOutput)</a>. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static long CheckFooter(ChecksumIndexInput in)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.ChecksumIndexInput.html">ChecksumIndexInput</a></td>
<td><span class="parametername">in</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><p>Actual checksum value. </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>If the footer is invalid, if the checksum does not match,
or if <code data-dev-comment-type="paramref" class="paramref">in</code> is not properly positioned before the footer
at the end of the stream. </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_CheckHeader_Lucene_Net_Store_DataInput_System_String_System_Int32_System_Int32_.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.CheckHeader(Lucene.Net.Store.DataInput%2CSystem.String%2CSystem.Int32%2CSystem.Int32)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L124">View Source</a>
</span>
<a id="Lucene_Net_Codecs_CodecUtil_CheckHeader_" data-uid="Lucene.Net.Codecs.CodecUtil.CheckHeader*"></a>
<h4 id="Lucene_Net_Codecs_CodecUtil_CheckHeader_Lucene_Net_Store_DataInput_System_String_System_Int32_System_Int32_" data-uid="Lucene.Net.Codecs.CodecUtil.CheckHeader(Lucene.Net.Store.DataInput,System.String,System.Int32,System.Int32)">CheckHeader(DataInput, String, Int32, Int32)</h4>
<div class="markdown level1 summary"><p>Reads and validates a header previously written with
<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteHeader_Lucene_Net_Store_DataOutput_System_String_System_Int32_">WriteHeader(DataOutput, String, Int32)</a>.
<p>
When reading a file, supply the expected <code data-dev-comment-type="paramref" class="paramref">codec</code> and
an expected version range (<code data-dev-comment-type="paramref" class="paramref">minVersion</code> to <code data-dev-comment-type="paramref" class="paramref">maxVersion</code>).</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static int CheckHeader(DataInput in, string codec, int minVersion, int maxVersion)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.DataInput.html">DataInput</a></td>
<td><span class="parametername">in</span></td>
<td><p>Input stream, positioned at the point where the
header was previously written. Typically this is located
at the beginning of the file. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">codec</span></td>
<td><p>The expected codec name. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">minVersion</span></td>
<td><p>The minimum supported expected version number. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">maxVersion</span></td>
<td><p>The maximum supported expected version number. </p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><p>The actual version found, when a valid header is found
that matches <code data-dev-comment-type="paramref" class="paramref">codec</code>, with an actual version
where <code>minVersion &lt;= actual &lt;= maxVersion</code>.
Otherwise an exception is thrown. </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>If the first four bytes are not
<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_CODEC_MAGIC">CODEC_MAGIC</a>, or if the actual codec found is
not <code data-dev-comment-type="paramref" class="paramref">codec</code>. </p>
</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Index.IndexFormatTooOldException.html">IndexFormatTooOldException</a></td>
<td><p>If the actual version is less
than <code data-dev-comment-type="paramref" class="paramref">minVersion</code>. </p>
</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Index.IndexFormatTooNewException.html">IndexFormatTooNewException</a></td>
<td><p>If the actual version is greater
than <code data-dev-comment-type="paramref" class="paramref">maxVersion</code>. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>If there is an I/O error reading from the underlying medium. </p>
</td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Codecs_CodecUtil_CheckHeader_Lucene_Net_Store_DataInput_System_String_System_Int32_System_Int32__seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteHeader_Lucene_Net_Store_DataOutput_System_String_System_Int32_">WriteHeader(DataOutput, String, Int32)</a></div>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_CheckHeaderNoMagic_Lucene_Net_Store_DataInput_System_String_System_Int32_System_Int32_.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.CheckHeaderNoMagic(Lucene.Net.Store.DataInput%2CSystem.String%2CSystem.Int32%2CSystem.Int32)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L141">View Source</a>
</span>
<a id="Lucene_Net_Codecs_CodecUtil_CheckHeaderNoMagic_" data-uid="Lucene.Net.Codecs.CodecUtil.CheckHeaderNoMagic*"></a>
<h4 id="Lucene_Net_Codecs_CodecUtil_CheckHeaderNoMagic_Lucene_Net_Store_DataInput_System_String_System_Int32_System_Int32_" data-uid="Lucene.Net.Codecs.CodecUtil.CheckHeaderNoMagic(Lucene.Net.Store.DataInput,System.String,System.Int32,System.Int32)">CheckHeaderNoMagic(DataInput, String, Int32, Int32)</h4>
<div class="markdown level1 summary"><p>Like
<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_CheckHeader_Lucene_Net_Store_DataInput_System_String_System_Int32_System_Int32_">CheckHeader(DataInput, String, Int32, Int32)</a> except this
version assumes the first <span class="xref">System.Int32</span> has already been read
and validated from the input.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static int CheckHeaderNoMagic(DataInput in, string codec, int minVersion, int maxVersion)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.DataInput.html">DataInput</a></td>
<td><span class="parametername">in</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">codec</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">minVersion</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">maxVersion</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_ChecksumEntireFile_Lucene_Net_Store_IndexInput_.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.ChecksumEntireFile(Lucene.Net.Store.IndexInput)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L265">View Source</a>
</span>
<a id="Lucene_Net_Codecs_CodecUtil_ChecksumEntireFile_" data-uid="Lucene.Net.Codecs.CodecUtil.ChecksumEntireFile*"></a>
<h4 id="Lucene_Net_Codecs_CodecUtil_ChecksumEntireFile_Lucene_Net_Store_IndexInput_" data-uid="Lucene.Net.Codecs.CodecUtil.ChecksumEntireFile(Lucene.Net.Store.IndexInput)">ChecksumEntireFile(IndexInput)</h4>
<div class="markdown level1 summary"><p>Clones the provided input, reads all bytes from the file, and calls <a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_CheckFooter_Lucene_Net_Store_ChecksumIndexInput_">CheckFooter(ChecksumIndexInput)</a>
<p>
Note that this method may be slow, as it must process the entire file.
If you just need to extract the checksum value, call <a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_RetrieveChecksum_Lucene_Net_Store_IndexInput_">RetrieveChecksum(IndexInput)</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static long ChecksumEntireFile(IndexInput input)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.IndexInput.html">IndexInput</a></td>
<td><span class="parametername">input</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_FooterLength.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.FooterLength%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L194">View Source</a>
</span>
<a id="Lucene_Net_Codecs_CodecUtil_FooterLength_" data-uid="Lucene.Net.Codecs.CodecUtil.FooterLength*"></a>
<h4 id="Lucene_Net_Codecs_CodecUtil_FooterLength" data-uid="Lucene.Net.Codecs.CodecUtil.FooterLength">FooterLength()</h4>
<div class="markdown level1 summary"><p>Computes the length of a codec footer.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static int FooterLength()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><p>Length of the entire codec footer. </p>
</td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Codecs_CodecUtil_FooterLength_seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteFooter_Lucene_Net_Store_IndexOutput_">WriteFooter(IndexOutput)</a></div>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_HeaderLength_System_String_.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.HeaderLength(System.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L93">View Source</a>
</span>
<a id="Lucene_Net_Codecs_CodecUtil_HeaderLength_" data-uid="Lucene.Net.Codecs.CodecUtil.HeaderLength*"></a>
<h4 id="Lucene_Net_Codecs_CodecUtil_HeaderLength_System_String_" data-uid="Lucene.Net.Codecs.CodecUtil.HeaderLength(System.String)">HeaderLength(String)</h4>
<div class="markdown level1 summary"><p>Computes the length of a codec header.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static int HeaderLength(string codec)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">codec</span></td>
<td><p>Codec name. </p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><p>Length of the entire codec header. </p>
</td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Codecs_CodecUtil_HeaderLength_System_String__seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteHeader_Lucene_Net_Store_DataOutput_System_String_System_Int32_">WriteHeader(DataOutput, String, Int32)</a></div>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_RetrieveChecksum_Lucene_Net_Store_IndexInput_.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.RetrieveChecksum(Lucene.Net.Store.IndexInput)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L225">View Source</a>
</span>
<a id="Lucene_Net_Codecs_CodecUtil_RetrieveChecksum_" data-uid="Lucene.Net.Codecs.CodecUtil.RetrieveChecksum*"></a>
<h4 id="Lucene_Net_Codecs_CodecUtil_RetrieveChecksum_Lucene_Net_Store_IndexInput_" data-uid="Lucene.Net.Codecs.CodecUtil.RetrieveChecksum(Lucene.Net.Store.IndexInput)">RetrieveChecksum(IndexInput)</h4>
<div class="markdown level1 summary"><p>Returns (but does not validate) the checksum previously written by <a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_CheckFooter_Lucene_Net_Store_ChecksumIndexInput_">CheckFooter(ChecksumIndexInput)</a>. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static long RetrieveChecksum(IndexInput in)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.IndexInput.html">IndexInput</a></td>
<td><span class="parametername">in</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><p>actual checksum value </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>If the footer is invalid. </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_WriteFooter_Lucene_Net_Store_IndexOutput_.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.WriteFooter(Lucene.Net.Store.IndexOutput)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L182">View Source</a>
</span>
<a id="Lucene_Net_Codecs_CodecUtil_WriteFooter_" data-uid="Lucene.Net.Codecs.CodecUtil.WriteFooter*"></a>
<h4 id="Lucene_Net_Codecs_CodecUtil_WriteFooter_Lucene_Net_Store_IndexOutput_" data-uid="Lucene.Net.Codecs.CodecUtil.WriteFooter(Lucene.Net.Store.IndexOutput)">WriteFooter(IndexOutput)</h4>
<div class="markdown level1 summary"><p>Writes a codec footer, which records both a checksum
algorithm ID and a checksum. This footer can
be parsed and validated with
<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_CheckFooter_Lucene_Net_Store_ChecksumIndexInput_">CheckFooter(ChecksumIndexInput)</a>.
<p>
CodecFooter --&gt; Magic,AlgorithmID,Checksum
<ul><li>Magic --&gt; Uint32 (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteInt32_System_Int32_">WriteInt32(Int32)</a>). this
identifies the start of the footer. It is always <a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_FOOTER_MAGIC">FOOTER_MAGIC</a>.</li><li>AlgorithmID --&gt; Uint32 (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteInt32_System_Int32_">WriteInt32(Int32)</a>). this
indicates the checksum algorithm used. Currently this is always 0,
for zlib-crc32.</li><li>Checksum --&gt; Uint32 (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteInt64_System_Int64_">WriteInt64(Int64)</a>). The
actual checksum value for all previous bytes in the stream, including
the bytes from Magic and AlgorithmID.</li></ul></p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void WriteFooter(IndexOutput out)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.IndexOutput.html">IndexOutput</a></td>
<td><span class="parametername">out</span></td>
<td><p>Output stream </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>If there is an I/O error writing to the underlying medium. </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil_WriteHeader_Lucene_Net_Store_DataOutput_System_String_System_Int32_.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil.WriteHeader(Lucene.Net.Store.DataOutput%2CSystem.String%2CSystem.Int32)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L75">View Source</a>
</span>
<a id="Lucene_Net_Codecs_CodecUtil_WriteHeader_" data-uid="Lucene.Net.Codecs.CodecUtil.WriteHeader*"></a>
<h4 id="Lucene_Net_Codecs_CodecUtil_WriteHeader_Lucene_Net_Store_DataOutput_System_String_System_Int32_" data-uid="Lucene.Net.Codecs.CodecUtil.WriteHeader(Lucene.Net.Store.DataOutput,System.String,System.Int32)">WriteHeader(DataOutput, String, Int32)</h4>
<div class="markdown level1 summary"><p>Writes a codec header, which records both a string to
identify the file and a version number. This header can
be parsed and validated with
<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_CheckHeader_Lucene_Net_Store_DataInput_System_String_System_Int32_System_Int32_">CheckHeader(DataInput, String, Int32, Int32)</a>.
<p>
CodecHeader --&gt; Magic,CodecName,Version
<ul><li>Magic --&gt; Uint32 (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteInt32_System_Int32_">WriteInt32(Int32)</a>). this
identifies the start of the header. It is always <a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_CODEC_MAGIC">CODEC_MAGIC</a>.</li><li>CodecName --&gt; String (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteString_System_String_">WriteString(String)</a>). this
is a string to identify this file.</li><li>Version --&gt; Uint32 (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteInt32_System_Int32_">WriteInt32(Int32)</a>). Records
the version of the file.</li></ul>
<p>
Note that the length of a codec header depends only upon the
name of the codec, so this length can be computed at any time
with <a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_HeaderLength_System_String_">HeaderLength(String)</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void WriteHeader(DataOutput out, string codec, int version)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.DataOutput.html">DataOutput</a></td>
<td><span class="parametername">out</span></td>
<td><p>Output stream </p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">codec</span></td>
<td><p>String to identify this file. It should be simple ASCII,
less than 128 characters in length. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">version</span></td>
<td><p>Version number </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>If there is an I/O error writing to the underlying medium. </p>
</td>
</tr>
</tbody>
</table>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Codecs_CodecUtil.md&amp;value=---%0Auid%3A%20Lucene.Net.Codecs.CodecUtil%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
</li>
<li>
<a href="https://github.com/apache/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Codecs/CodecUtil.cs/#L34" class="contribution-link">View Source</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
Copyright © 2020 Licensed to the Apache Software Foundation (ASF)
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.js"></script>
</body>
</html>