Replace new FileInputStream with Files.newInputStream()#183
Replace new FileInputStream with Files.newInputStream()#183arturobernalg wants to merge 1 commit intoapache:masterfrom
Conversation
|
What are the benefits of this change? |
It integrates seamlessly with the Path class, offers more flexible open options, and works well with try-with-resources for automatic resource management. In short, it’s a more robust, future-proof approach compared to the legacy FileInputStream. |
|
AFAICT, it returns an InputStream rather than a FileInputStream. This means that some methods are not directly available. For example getFD, getChannel. |
|
This looks like an OK internal change from IO to NIO. If you need a |
|
I'm fine with changing, or leaving this, as it is. A more deserving change would be, IMO, to introduce try-with-resources here. |
|
The changes in this PR are not fully baked IMO. I pushed changes that use better NIO APIs, for example to read and write a file in one shot without having to create streams. |
5c1c0b8 to
85a2028
Compare
Thanks for your contribution to Apache Commons! Your help is appreciated!
Before you push a pull request, review this list:
mvn; that'smvnon the command line by itself.