Files
2025-02-05 04:43:28 +00:00

36 lines
1.3 KiB
HTML

<html>
<body>
Reports I/O resources that are not safely closed. I/O resources checked
by this inspection include <code>java.io.InputStream</code>,
<code>java.io.OutputStream</code>, <code>java.io.Reader</code>,
<code>java.io.Writer</code>, <code>java.util.zip.ZipFile</code>, <code>java.io.Closeable</code> and <code>java.io.RandomAccessFile</code>.
<p>
I/O resources wrapped by other I/O resources are not reported, as the wrapped resource will be closed by the wrapping resource.
</p>
<p>
By default, the inspection assumes that the resources can be closed by any method with
'close' or 'cleanup' in its name.
</p>
<p><b>Example:</b></p>
<pre><code>
void save() throws IOException {
FileWriter writer = new FileWriter("filename.txt"); //warning
writer.write("sample");
}
</code></pre>
<!-- tooltip end -->
<p>
Use the following options to configure the inspection:
</p>
<ul>
<li>List I/O resource classes that do not need to be closed and should be ignored by this inspection.</li>
<li>
Whether an I/O resource is allowed to be opened inside a <code>try</code>block.
This style is less desirable because it is more verbose than opening a resource in front of a <code>try</code> block.
</li>
<li>
Whether the resource can be closed by any method call with the resource passed as argument.
</li>
</ul>
</body>
</html>