Proposed patch: further wrapping of FileInputStream's native method

Alan Bateman Alan.Bateman at oracle.com
Tue May 10 08:43:45 UTC 2016


On 10/05/2016 08:13, Chan, Sunny wrote:
> The available() and sync() are the only native methods in the FileInputStream that has not been "wrapped".
>
> Our use case is that we have an internal storage implementation and we would like to be able to provide support for older applications that use  java.io api without modify the apps to use our NIO.2 Filesystem implementation. Without these method wrapped it is difficult to instrument them and redirect calls as needed.
>
> A longer term goal is to investigate and see whether we can find a way to divert all the old java.io APIs to an NIO.2 filesystem implementation. However this is more complex and will involve a much bigger change and we will propose a JEP once we are confident that can be done.
>
Just an FYI that back in JDK 7 then we had an initial prototype 
implementation of java.io.File/FIS/FOS/RAF that was based on the new 
file system API. As I recall, the concerns/issues at the time were:

1. Compatibility, esp. Windows, where the new API/implementation does 
the right thing and so results in changes in behavior.

2. Startup as the new API/implementation requires loading additional 
classes at startup. In JDK 9 then the jimage container and the module 
system use the new API and so we are loading them anywhere so this issue 
may have gone away.

3. FIS/FOS ctors/getFD which won't have an equivalent or it specific to 
the default provider.

It would definitely be interesting to have another go at this.

-Alan



More information about the core-libs-dev mailing list