You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason is is that FileInputStream and FileOutputStream have finalizers and therefore puts pressure on the GC. The finalizers will make sure the file descriptor is actually released if the developer has forgotten to explicitly close the fis or fos. But if this is taken care of, then there's no need to have the overhead that use of fis or fos implies.
It is not in all cases that a fis or a fos can be replaced with the JDK7 equivalents from Files class. But in the cases where the fis or fos doesn't escape the method then it can always be replaced and the hint would apply.
The text was updated successfully, but these errors were encountered:
@lbruun: Good idea, but I do not actively support this plugin anymore. Nevertheless you could provide a pull-request, which I will merge. See the existing classes and the tests to get started.
Files.newInputStream() and Files.newOutputStream() are generally preferred over
new FileInputStream()
andnew FileOutputStream()
.The reason is is that
FileInputStream
andFileOutputStream
have finalizers and therefore puts pressure on the GC. The finalizers will make sure the file descriptor is actually released if the developer has forgotten to explicitly close the fis or fos. But if this is taken care of, then there's no need to have the overhead that use of fis or fos implies.It is not in all cases that a fis or a fos can be replaced with the JDK7 equivalents from
Files
class. But in the cases where the fis or fos doesn't escape the method then it can always be replaced and the hint would apply.The text was updated successfully, but these errors were encountered: