You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/06/07 13:51:35 UTC

[GitHub] [commons-io] garydgregory commented on pull request #221: Replace construction of FileInputStream and FileOutputStream objects with Files NIO APIs.

garydgregory commented on pull request #221:
URL: https://github.com/apache/commons-io/pull/221#issuecomment-855947946


   > 
   > 
   > > Files.newInputstream() to new FileInputStream()
   > 
   > HI @jochenw
   > This is the reason -->
   > 'Basically, FileInputStream and FileOutputStream both use a finalizer to ensure that the resources are closed.
   > Even with programmers do call close() after using FileInputStream, its finalize() method will still be called. In other words, still get the side effect of the FinalReference being registered at FileInputStream allocation time, and also reference processing to reclaim the FinalReference during GC (any GC solution has to deal with this).'
   
   Indeed, @jochenw do notice `java.io.FileInputStream.finalize()` and `java.io.FileOutputStream.finalize()`. I'll review further but I am incline to merged based on the `finalize()` issue. While in the long term I think finalization is going away, we are still on Java 8 for now.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org