blob: 0f1468e452b0c20a50bd4b99e50dc7ea81f9884e [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 IOUtils
| Apache Lucene.NET 4.8.0-beta00010 Documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class IOUtils
| 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.Util.IOUtils">
<h1 id="Lucene_Net_Util_IOUtils" data-uid="Lucene.Net.Util.IOUtils" class="text-break">Class IOUtils
</h1>
<div class="markdown level0 summary"><p>This class emulates the new Java 7 &quot;Try-With-Resources&quot; statement.
Remove once Lucene is on Java 7.
<p>
<div class="lucene-block lucene-internal">This is a Lucene.NET INTERNAL 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">IOUtils</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.Util.html">Lucene.Net.Util</a></h6>
<h6><strong>Assembly</strong>: Lucene.Net.dll</h6>
<h5 id="Lucene_Net_Util_IOUtils_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public sealed class IOUtils</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_Util_IOUtils_CHARSET_UTF_8.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.CHARSET_UTF_8%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/Util/IOUtils.cs/#L42">View Source</a>
</span>
<h4 id="Lucene_Net_Util_IOUtils_CHARSET_UTF_8" data-uid="Lucene.Net.Util.IOUtils.CHARSET_UTF_8">CHARSET_UTF_8</h4>
<div class="markdown level1 summary"><p>UTF-8 <span class="xref">System.Text.Encoding</span> instance to prevent repeated
<span class="xref">System.Text.Encoding.UTF8</span> lookups </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 Encoding.UTF8 instead.&quot;)]
public static readonly Encoding CHARSET_UTF_8</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.Text.Encoding</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_Util_IOUtils_UTF_8.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.UTF_8%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/Util/IOUtils.cs/#L49">View Source</a>
</span>
<h4 id="Lucene_Net_Util_IOUtils_UTF_8" data-uid="Lucene.Net.Util.IOUtils.UTF_8">UTF_8</h4>
<div class="markdown level1 summary"><p>UTF-8 charset string.
<p>Where possible, use <span class="xref">System.Text.Encoding.UTF8</span> instead,
as using the <span class="xref">System.String</span> constant may slow things down. </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 string UTF_8</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.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Util_IOUtils_UTF_8_seealso">See Also</h5>
<div class="seealso">
<div><span class="xref">System.Text.Encoding.UTF8</span></div>
</div>
<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_Util_IOUtils_Close_System_Collections_Generic_IEnumerable_System_IDisposable__.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.Close(System.Collections.Generic.IEnumerable%7BSystem.IDisposable%7D)%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/Util/IOUtils.cs/#L114">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_Close_" data-uid="Lucene.Net.Util.IOUtils.Close*"></a>
<h4 id="Lucene_Net_Util_IOUtils_Close_System_Collections_Generic_IEnumerable_System_IDisposable__" data-uid="Lucene.Net.Util.IOUtils.Close(System.Collections.Generic.IEnumerable{System.IDisposable})">Close(IEnumerable&lt;IDisposable&gt;)</h4>
<div class="markdown level1 summary"><p>Disposes all given <span class="xref">System.IDisposable</span>s. </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 Dispose(IEnumerable&lt;IDisposable&gt;) instead.&quot;)]
public static void Close(IEnumerable&lt;IDisposable&gt; objects)</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.Collections.Generic.IEnumerable</span>&lt;<span class="xref">System.IDisposable</span>&gt;</td>
<td><span class="parametername">objects</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Util_IOUtils_Close_System_Collections_Generic_IEnumerable_System_IDisposable___seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Util.IOUtils.html#Lucene_Net_Util_IOUtils_Dispose_System_IDisposable___">Dispose(IDisposable[])</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_Util_IOUtils_Close_System_IDisposable___.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.Close(System.IDisposable%5B%5D)%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/Util/IOUtils.cs/#L105">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_Close_" data-uid="Lucene.Net.Util.IOUtils.Close*"></a>
<h4 id="Lucene_Net_Util_IOUtils_Close_System_IDisposable___" data-uid="Lucene.Net.Util.IOUtils.Close(System.IDisposable[])">Close(IDisposable[])</h4>
<div class="markdown level1 summary"><p>Disposes all given <span class="xref">System.IDisposable</span>s. Some of the
<span class="xref">System.IDisposable</span>s may be <code>null</code>; they are
ignored. After everything is closed, the method either
throws the first exception it hit while closing, or
completes normally if there were no exceptions.</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 Dispose(params IDisposable[]) instead.&quot;)]
public static void Close(params IDisposable[] objects)</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.IDisposable</span>[]</td>
<td><span class="parametername">objects</span></td>
<td><p>Objects to call <span class="xref">System.IDisposable.Dispose()</span> on </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_Util_IOUtils_CloseWhileHandlingException_System_Collections_Generic_IEnumerable_System_IDisposable__.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.CloseWhileHandlingException(System.Collections.Generic.IEnumerable%7BSystem.IDisposable%7D)%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/Util/IOUtils.cs/#L136">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_CloseWhileHandlingException_" data-uid="Lucene.Net.Util.IOUtils.CloseWhileHandlingException*"></a>
<h4 id="Lucene_Net_Util_IOUtils_CloseWhileHandlingException_System_Collections_Generic_IEnumerable_System_IDisposable__" data-uid="Lucene.Net.Util.IOUtils.CloseWhileHandlingException(System.Collections.Generic.IEnumerable{System.IDisposable})">CloseWhileHandlingException(IEnumerable&lt;IDisposable&gt;)</h4>
<div class="markdown level1 summary"><p>Disposes all given <span class="xref">System.IDisposable</span>s, suppressing all thrown exceptions. </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 DisposeWhileHandlingException(IEnumerable&lt;IDisposable&gt;) instead.&quot;)]
public static void CloseWhileHandlingException(IEnumerable&lt;IDisposable&gt; objects)</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.Collections.Generic.IEnumerable</span>&lt;<span class="xref">System.IDisposable</span>&gt;</td>
<td><span class="parametername">objects</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Util_IOUtils_CloseWhileHandlingException_System_Collections_Generic_IEnumerable_System_IDisposable___seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Util.IOUtils.html#Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_System_Collections_Generic_IEnumerable_System_IDisposable__">DisposeWhileHandlingException(IEnumerable&lt;IDisposable&gt;)</a></div>
<div><a class="xref" href="Lucene.Net.Util.IOUtils.html#Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_System_IDisposable___">DisposeWhileHandlingException(IDisposable[])</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_Util_IOUtils_CloseWhileHandlingException_System_Exception_System_Collections_Generic_IEnumerable_System_IDisposable__.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.CloseWhileHandlingException(System.Exception%2CSystem.Collections.Generic.IEnumerable%7BSystem.IDisposable%7D)%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/Util/IOUtils.cs/#L90">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_CloseWhileHandlingException_" data-uid="Lucene.Net.Util.IOUtils.CloseWhileHandlingException*"></a>
<h4 id="Lucene_Net_Util_IOUtils_CloseWhileHandlingException_System_Exception_System_Collections_Generic_IEnumerable_System_IDisposable__" data-uid="Lucene.Net.Util.IOUtils.CloseWhileHandlingException(System.Exception,System.Collections.Generic.IEnumerable{System.IDisposable})">CloseWhileHandlingException(Exception, IEnumerable&lt;IDisposable&gt;)</h4>
<div class="markdown level1 summary"><p>Disposes all given <span class="xref">System.IDisposable</span>s, suppressing all thrown exceptions. </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 DisposeWhileHandlingException(Exception, IEnumerable&lt;IDisposable&gt;) instead.&quot;)]
public static void CloseWhileHandlingException(Exception priorException, IEnumerable&lt;IDisposable&gt; objects)</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.Exception</span></td>
<td><span class="parametername">priorException</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<span class="xref">System.IDisposable</span>&gt;</td>
<td><span class="parametername">objects</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Util_IOUtils_CloseWhileHandlingException_System_Exception_System_Collections_Generic_IEnumerable_System_IDisposable___seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Util.IOUtils.html#Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_System_Exception_System_IDisposable___">DisposeWhileHandlingException(Exception, IDisposable[])</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_Util_IOUtils_CloseWhileHandlingException_System_Exception_System_IDisposable___.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.CloseWhileHandlingException(System.Exception%2CSystem.IDisposable%5B%5D)%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/Util/IOUtils.cs/#L81">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_CloseWhileHandlingException_" data-uid="Lucene.Net.Util.IOUtils.CloseWhileHandlingException*"></a>
<h4 id="Lucene_Net_Util_IOUtils_CloseWhileHandlingException_System_Exception_System_IDisposable___" data-uid="Lucene.Net.Util.IOUtils.CloseWhileHandlingException(System.Exception,System.IDisposable[])">CloseWhileHandlingException(Exception, IDisposable[])</h4>
<div class="markdown level1 summary"><p>Disposes all given <code>IDisposable</code>s, suppressing all thrown exceptions. Some of the <code>IDisposable</code>s
may be <code>null</code>, they are ignored. After everything is disposed, method either throws <code data-dev-comment-type="paramref" class="paramref">priorException</code>,
if one is supplied, or the first of suppressed exceptions, or completes normally.</p>
<p>Sample usage:
<pre><code>IDisposable resource1 = null, resource2 = null, resource3 = null;
ExpectedException priorE = null;
try
{
resource1 = ...; resource2 = ...; resource3 = ...; // Acquisition may throw ExpectedException
..do..stuff.. // May throw ExpectedException
}
catch (ExpectedException e)
{
priorE = e;
}
finally
{
IOUtils.CloseWhileHandlingException(priorE, resource1, resource2, resource3);
}</code></pre>
</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 DisposeWhileHandlingException(Exception, params IDisposable[]) instead.&quot;)]
public static void CloseWhileHandlingException(Exception priorException, params IDisposable[] objects)</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.Exception</span></td>
<td><span class="parametername">priorException</span></td>
<td><p><code>null</code> or an exception that will be rethrown after method completion. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IDisposable</span>[]</td>
<td><span class="parametername">objects</span></td>
<td><p>Objects to call <span class="xref">System.IDisposable.Dispose()</span> on. </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_Util_IOUtils_CloseWhileHandlingException_System_IDisposable___.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.CloseWhileHandlingException(System.IDisposable%5B%5D)%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/Util/IOUtils.cs/#L126">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_CloseWhileHandlingException_" data-uid="Lucene.Net.Util.IOUtils.CloseWhileHandlingException*"></a>
<h4 id="Lucene_Net_Util_IOUtils_CloseWhileHandlingException_System_IDisposable___" data-uid="Lucene.Net.Util.IOUtils.CloseWhileHandlingException(System.IDisposable[])">CloseWhileHandlingException(IDisposable[])</h4>
<div class="markdown level1 summary"><p>Disposes all given <span class="xref">System.IDisposable</span>s, suppressing all thrown exceptions.
Some of the <span class="xref">System.IDisposable</span>s may be <code>null</code>, they are ignored.</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 DisposeWhileHandlingException(params IDisposable[]) instead.&quot;)]
public static void CloseWhileHandlingException(params IDisposable[] objects)</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.IDisposable</span>[]</td>
<td><span class="parametername">objects</span></td>
<td><p>Objects to call <span class="xref">System.IDisposable.Dispose()</span> on </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_Util_IOUtils_Copy_System_IO_FileInfo_System_IO_FileInfo_.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.Copy(System.IO.FileInfo%2CSystem.IO.FileInfo)%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/Util/IOUtils.cs/#L471">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_Copy_" data-uid="Lucene.Net.Util.IOUtils.Copy*"></a>
<h4 id="Lucene_Net_Util_IOUtils_Copy_System_IO_FileInfo_System_IO_FileInfo_" data-uid="Lucene.Net.Util.IOUtils.Copy(System.IO.FileInfo,System.IO.FileInfo)">Copy(FileInfo, FileInfo)</h4>
<div class="markdown level1 summary"><p>Copy one file&apos;s contents to another file. The target will be overwritten
if it exists. The source must exist.</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 Copy(FileInfo source, FileInfo target)</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.IO.FileInfo</span></td>
<td><span class="parametername">source</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.IO.FileInfo</span></td>
<td><span class="parametername">target</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_Util_IOUtils_DeleteFilesIgnoringExceptions_Lucene_Net_Store_Directory_System_String___.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.DeleteFilesIgnoringExceptions(Lucene.Net.Store.Directory%2CSystem.String%5B%5D)%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/Util/IOUtils.cs/#L452">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_DeleteFilesIgnoringExceptions_" data-uid="Lucene.Net.Util.IOUtils.DeleteFilesIgnoringExceptions*"></a>
<h4 id="Lucene_Net_Util_IOUtils_DeleteFilesIgnoringExceptions_Lucene_Net_Store_Directory_System_String___" data-uid="Lucene.Net.Util.IOUtils.DeleteFilesIgnoringExceptions(Lucene.Net.Store.Directory,System.String[])">DeleteFilesIgnoringExceptions(Directory, String[])</h4>
<div class="markdown level1 summary"><p>Deletes all given files, suppressing all thrown <span class="xref">System.Exception</span>s.
<p>
Note that the files should not be <code>null</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 void DeleteFilesIgnoringExceptions(Directory dir, params string[] files)</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.Directory.html">Directory</a></td>
<td><span class="parametername">dir</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.String</span>[]</td>
<td><span class="parametername">files</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_Util_IOUtils_Dispose_System_Collections_Generic_IEnumerable_System_IDisposable__.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.Dispose(System.Collections.Generic.IEnumerable%7BSystem.IDisposable%7D)%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/Util/IOUtils.cs/#L278">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_Dispose_" data-uid="Lucene.Net.Util.IOUtils.Dispose*"></a>
<h4 id="Lucene_Net_Util_IOUtils_Dispose_System_Collections_Generic_IEnumerable_System_IDisposable__" data-uid="Lucene.Net.Util.IOUtils.Dispose(System.Collections.Generic.IEnumerable{System.IDisposable})">Dispose(IEnumerable&lt;IDisposable&gt;)</h4>
<div class="markdown level1 summary"><p>Disposes all given <span class="xref">System.IDisposable</span>s. </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 Dispose(IEnumerable&lt;IDisposable&gt; objects)</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.Collections.Generic.IEnumerable</span>&lt;<span class="xref">System.IDisposable</span>&gt;</td>
<td><span class="parametername">objects</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Util_IOUtils_Dispose_System_Collections_Generic_IEnumerable_System_IDisposable___seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Util.IOUtils.html#Lucene_Net_Util_IOUtils_Dispose_System_IDisposable___">Dispose(IDisposable[])</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_Util_IOUtils_Dispose_System_IDisposable___.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.Dispose(System.IDisposable%5B%5D)%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/Util/IOUtils.cs/#L249">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_Dispose_" data-uid="Lucene.Net.Util.IOUtils.Dispose*"></a>
<h4 id="Lucene_Net_Util_IOUtils_Dispose_System_IDisposable___" data-uid="Lucene.Net.Util.IOUtils.Dispose(System.IDisposable[])">Dispose(IDisposable[])</h4>
<div class="markdown level1 summary"><p>Disposes all given <span class="xref">System.IDisposable</span>s. Some of the
<span class="xref">System.IDisposable</span>s may be <code>null</code>; they are
ignored. After everything is closed, the method either
throws the first exception it hit while closing, or
completes normally if there were no exceptions.</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 Dispose(params IDisposable[] objects)</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.IDisposable</span>[]</td>
<td><span class="parametername">objects</span></td>
<td><p>Objects to call <span class="xref">System.IDisposable.Dispose()</span> on </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_Util_IOUtils_DisposeWhileHandlingException_System_Collections_Generic_IEnumerable_System_IDisposable__.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.DisposeWhileHandlingException(System.Collections.Generic.IEnumerable%7BSystem.IDisposable%7D)%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/Util/IOUtils.cs/#L331">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_" data-uid="Lucene.Net.Util.IOUtils.DisposeWhileHandlingException*"></a>
<h4 id="Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_System_Collections_Generic_IEnumerable_System_IDisposable__" data-uid="Lucene.Net.Util.IOUtils.DisposeWhileHandlingException(System.Collections.Generic.IEnumerable{System.IDisposable})">DisposeWhileHandlingException(IEnumerable&lt;IDisposable&gt;)</h4>
<div class="markdown level1 summary"><p>Disposes all given <span class="xref">System.IDisposable</span>s, suppressing all thrown exceptions. </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 DisposeWhileHandlingException(IEnumerable&lt;IDisposable&gt; objects)</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.Collections.Generic.IEnumerable</span>&lt;<span class="xref">System.IDisposable</span>&gt;</td>
<td><span class="parametername">objects</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_System_Collections_Generic_IEnumerable_System_IDisposable___seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Util.IOUtils.html#Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_System_IDisposable___">DisposeWhileHandlingException(IDisposable[])</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_Util_IOUtils_DisposeWhileHandlingException_System_Exception_System_Collections_Generic_IEnumerable_System_IDisposable__.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.DisposeWhileHandlingException(System.Exception%2CSystem.Collections.Generic.IEnumerable%7BSystem.IDisposable%7D)%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/Util/IOUtils.cs/#L207">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_" data-uid="Lucene.Net.Util.IOUtils.DisposeWhileHandlingException*"></a>
<h4 id="Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_System_Exception_System_Collections_Generic_IEnumerable_System_IDisposable__" data-uid="Lucene.Net.Util.IOUtils.DisposeWhileHandlingException(System.Exception,System.Collections.Generic.IEnumerable{System.IDisposable})">DisposeWhileHandlingException(Exception, IEnumerable&lt;IDisposable&gt;)</h4>
<div class="markdown level1 summary"><p>Disposes all given <span class="xref">System.IDisposable</span>s, suppressing all thrown exceptions. </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 DisposeWhileHandlingException(Exception priorException, IEnumerable&lt;IDisposable&gt; objects)</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.Exception</span></td>
<td><span class="parametername">priorException</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<span class="xref">System.IDisposable</span>&gt;</td>
<td><span class="parametername">objects</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_System_Exception_System_Collections_Generic_IEnumerable_System_IDisposable___seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Util.IOUtils.html#Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_System_Exception_System_IDisposable___">DisposeWhileHandlingException(Exception, IDisposable[])</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_Util_IOUtils_DisposeWhileHandlingException_System_Exception_System_IDisposable___.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.DisposeWhileHandlingException(System.Exception%2CSystem.IDisposable%5B%5D)%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/Util/IOUtils.cs/#L171">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_" data-uid="Lucene.Net.Util.IOUtils.DisposeWhileHandlingException*"></a>
<h4 id="Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_System_Exception_System_IDisposable___" data-uid="Lucene.Net.Util.IOUtils.DisposeWhileHandlingException(System.Exception,System.IDisposable[])">DisposeWhileHandlingException(Exception, IDisposable[])</h4>
<div class="markdown level1 summary"><p>Disposes all given <code>IDisposable</code>s, suppressing all thrown exceptions. Some of the <code>IDisposable</code>s
may be <code>null</code>, they are ignored. After everything is disposed, method either throws <code data-dev-comment-type="paramref" class="paramref">priorException</code>,
if one is supplied, or the first of suppressed exceptions, or completes normally.</p>
<p>Sample usage:
<pre><code>IDisposable resource1 = null, resource2 = null, resource3 = null;
ExpectedException priorE = null;
try
{
resource1 = ...; resource2 = ...; resource3 = ...; // Acquisition may throw ExpectedException
..do..stuff.. // May throw ExpectedException
}
catch (ExpectedException e)
{
priorE = e;
}
finally
{
IOUtils.DisposeWhileHandlingException(priorE, resource1, resource2, resource3);
}</code></pre>
</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 DisposeWhileHandlingException(Exception priorException, params IDisposable[] objects)</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.Exception</span></td>
<td><span class="parametername">priorException</span></td>
<td><p><code>null</code> or an exception that will be rethrown after method completion. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IDisposable</span>[]</td>
<td><span class="parametername">objects</span></td>
<td><p>Objects to call <span class="xref">System.IDisposable.Dispose()</span> on. </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_Util_IOUtils_DisposeWhileHandlingException_System_IDisposable___.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.DisposeWhileHandlingException(System.IDisposable%5B%5D)%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/Util/IOUtils.cs/#L310">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_" data-uid="Lucene.Net.Util.IOUtils.DisposeWhileHandlingException*"></a>
<h4 id="Lucene_Net_Util_IOUtils_DisposeWhileHandlingException_System_IDisposable___" data-uid="Lucene.Net.Util.IOUtils.DisposeWhileHandlingException(System.IDisposable[])">DisposeWhileHandlingException(IDisposable[])</h4>
<div class="markdown level1 summary"><p>Disposes all given <span class="xref">System.IDisposable</span>s, suppressing all thrown exceptions.
Some of the <span class="xref">System.IDisposable</span>s may be <code>null</code>, they are ignored.</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 DisposeWhileHandlingException(params IDisposable[] objects)</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.IDisposable</span>[]</td>
<td><span class="parametername">objects</span></td>
<td><p>Objects to call <span class="xref">System.IDisposable.Dispose()</span> on </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_Util_IOUtils_GetDecodingReader_System_IO_FileInfo_System_Text_Encoding_.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.GetDecodingReader(System.IO.FileInfo%2CSystem.Text.Encoding)%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/Util/IOUtils.cs/#L395">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_GetDecodingReader_" data-uid="Lucene.Net.Util.IOUtils.GetDecodingReader*"></a>
<h4 id="Lucene_Net_Util_IOUtils_GetDecodingReader_System_IO_FileInfo_System_Text_Encoding_" data-uid="Lucene.Net.Util.IOUtils.GetDecodingReader(System.IO.FileInfo,System.Text.Encoding)">GetDecodingReader(FileInfo, Encoding)</h4>
<div class="markdown level1 summary"><p>Opens a <span class="xref">System.IO.TextReader</span> for the given <span class="xref">System.IO.FileInfo</span> using a <span class="xref">System.Text.Encoding</span>.
Unlike Java&apos;s defaults this reader will throw an exception if your it detects
the read charset doesn&apos;t match the expected <span class="xref">System.Text.Encoding</span>.
<p>
Decoding readers are useful to load configuration files, stopword lists or synonym files
to detect character set problems. However, its not recommended to use as a common purpose
reader. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static TextReader GetDecodingReader(FileInfo file, Encoding charSet)</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.IO.FileInfo</span></td>
<td><span class="parametername">file</span></td>
<td><p>The file to open a reader on </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Text.Encoding</span></td>
<td><span class="parametername">charSet</span></td>
<td><p>The expected charset </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.IO.TextReader</span></td>
<td><p>A reader to read the given file </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_Util_IOUtils_GetDecodingReader_System_IO_Stream_System_Text_Encoding_.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.GetDecodingReader(System.IO.Stream%2CSystem.Text.Encoding)%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/Util/IOUtils.cs/#L379">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_GetDecodingReader_" data-uid="Lucene.Net.Util.IOUtils.GetDecodingReader*"></a>
<h4 id="Lucene_Net_Util_IOUtils_GetDecodingReader_System_IO_Stream_System_Text_Encoding_" data-uid="Lucene.Net.Util.IOUtils.GetDecodingReader(System.IO.Stream,System.Text.Encoding)">GetDecodingReader(Stream, Encoding)</h4>
<div class="markdown level1 summary"><p>Wrapping the given <span class="xref">System.IO.Stream</span> in a reader using a <span class="xref">System.Text.Encoding</span>.
Unlike Java&apos;s defaults this reader will throw an exception if your it detects
the read charset doesn&apos;t match the expected <span class="xref">System.Text.Encoding</span>.
<p>
Decoding readers are useful to load configuration files, stopword lists or synonym files
to detect character set problems. However, its not recommended to use as a common purpose
reader.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static TextReader GetDecodingReader(Stream stream, Encoding charSet)</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.IO.Stream</span></td>
<td><span class="parametername">stream</span></td>
<td><p>The stream to wrap in a reader </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Text.Encoding</span></td>
<td><span class="parametername">charSet</span></td>
<td><p>The expected charset </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.IO.TextReader</span></td>
<td><p>A wrapping reader </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_Util_IOUtils_GetDecodingReader_System_Type_System_String_System_Text_Encoding_.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.GetDecodingReader(System.Type%2CSystem.String%2CSystem.Text.Encoding)%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/Util/IOUtils.cs/#L427">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_GetDecodingReader_" data-uid="Lucene.Net.Util.IOUtils.GetDecodingReader*"></a>
<h4 id="Lucene_Net_Util_IOUtils_GetDecodingReader_System_Type_System_String_System_Text_Encoding_" data-uid="Lucene.Net.Util.IOUtils.GetDecodingReader(System.Type,System.String,System.Text.Encoding)">GetDecodingReader(Type, String, Encoding)</h4>
<div class="markdown level1 summary"><p>Opens a <span class="xref">System.IO.TextReader</span> for the given resource using a <span class="xref">System.Text.Encoding</span>.
Unlike Java&apos;s defaults this reader will throw an exception if your it detects
the read charset doesn&apos;t match the expected <span class="xref">System.Text.Encoding</span>.
<p>
Decoding readers are useful to load configuration files, stopword lists or synonym files
to detect character set problems. However, its not recommended to use as a common purpose
reader. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static TextReader GetDecodingReader(Type clazz, string resource, Encoding charSet)</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.Type</span></td>
<td><span class="parametername">clazz</span></td>
<td><p>The class used to locate the resource </p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">resource</span></td>
<td><p>The resource name to load </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Text.Encoding</span></td>
<td><span class="parametername">charSet</span></td>
<td><p>The expected charset </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.IO.TextReader</span></td>
<td><p>A reader to read the given file </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_Util_IOUtils_ReThrow_System_Exception_.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.ReThrow(System.Exception)%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/Util/IOUtils.cs/#L499">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_ReThrow_" data-uid="Lucene.Net.Util.IOUtils.ReThrow*"></a>
<h4 id="Lucene_Net_Util_IOUtils_ReThrow_System_Exception_" data-uid="Lucene.Net.Util.IOUtils.ReThrow(System.Exception)">ReThrow(Exception)</h4>
<div class="markdown level1 summary"><p>Simple utilty method that takes a previously caught
<span class="xref">System.Exception</span> and rethrows either
<span class="xref">System.IO.IOException</span> or an unchecked exception. If the
argument is <code>null</code> then this method does nothing.</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 ReThrow(Exception th)</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.Exception</span></td>
<td><span class="parametername">th</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_Util_IOUtils_ReThrowUnchecked_System_Exception_.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils.ReThrowUnchecked(System.Exception)%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/Util/IOUtils.cs/#L516">View Source</a>
</span>
<a id="Lucene_Net_Util_IOUtils_ReThrowUnchecked_" data-uid="Lucene.Net.Util.IOUtils.ReThrowUnchecked*"></a>
<h4 id="Lucene_Net_Util_IOUtils_ReThrowUnchecked_System_Exception_" data-uid="Lucene.Net.Util.IOUtils.ReThrowUnchecked(System.Exception)">ReThrowUnchecked(Exception)</h4>
<div class="markdown level1 summary"><p>Simple utilty method that takes a previously caught
<span class="xref">System.Exception</span> and rethrows it as an unchecked exception.
If the argument is <code>null</code> then this method does nothing.</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 ReThrowUnchecked(Exception th)</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.Exception</span></td>
<td><span class="parametername">th</span></td>
<td></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_Util_IOUtils.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.IOUtils%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/Util/IOUtils.cs/#L35" 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>