Files
openide/java/java-impl/resources/inspectionDescriptions/IOStreamConstructor.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

20 lines
907 B
HTML

<html>
<body>
Reports <code>new FileInputStream()</code> or <code>new FileOutputStream()</code> expressions that can be replaced
with <code>Files.newInputStream()</code> or <code>Files.newOutputStream()</code> calls respectively.
<br>
The streams created using <code>Files</code> methods are usually more efficient than those created by stream constructors.
<p>Example:</p>
<pre><code>
InputStream is = new BufferedInputStream(new FileInputStream(file));
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
InputStream is = new BufferedInputStream(Files.newInputStream(file.toPath()));
</code></pre>
<!-- tooltip end -->
<p>This inspection does not show warning if the language level 10 or higher, but the quick-fix is still available.</p>
<p>This inspection only reports if the language level of the project or module is 7 or higher.</p>
<p><small>New in 2022.1</small></p>
</body>
</html>