Replacing default FileSystemProvider

Alan Bateman Alan.Bateman at oracle.com
Mon Mar 22 08:43:44 UTC 2021


On 21/03/2021 23:09, Michael Hall wrote:
> Had to review what I had. Actually, mac_xattr is one of the API”s I supported nio attributes for…
>
> Map<String,Object> attrs = Files.readAttributes(p,"mac_xattr:*");
> 			assertEquals(2,attrs.size());
> 			assertTrue(attrs.containsKey("mac_xattr:com.apple.FinderInfo"));
> 			byte[] finfo = (byte[])attrs.get("mac_xattr:com.apple.FinderInfo");
> 			assertEquals(32,finfo.length);
>
> There was some redundancy across API’s.
>
> There is also the LaunchServices API
>
> if (!((Boolean)Files.getAttribute(p,"mac_ls:application")).booleanValue()) {
>
> One use is information about the default application associated with a file.
>
> And mac_cocoa for the NS API family
>
> assertFalse(((Boolean)Files.getAttribute(p,"mac_cocoa:NSFileBusy")).booleanValue());
> 			assertEquals(Files.size(p),((Long)Files.getAttribute(p,"mac_cocoa:NSFileSize")).longValue());
> 			attrs = Files.readAttributes(p,"mac_cocoa:NSFileModificationDate,mac_cocoa:NSFilePosixPermissions”);
>
> I’m not sure this API driven stuff would exactly translate to a user attribute view.
The com.apple.eio.FileManager API was an API in Apple's JDK up to JDK 6. 
The code came into the OpenJDK when support for macOS was added in 7u4 
but it wasn't tracked as a supported/documented interface. The 
java.desktop module can't export non-standard APIs so this is why it has 
been encapsulated (and not exposed) at compile-time since Java 9 (why 
you've had to compile with --add-exports java.desktop/com.apple.eio=... 
to compile code that uses it). It it encapsulated at run-time since Java 
16. Many of the features that eio.FileManager provided are superseded by 
standard APIs and java.awt.Desktop. My understanding is that 
type/creator codes are legacy and have been ignored on macOS for 10 
years so it might not be worth spending time trying to create a file 
attribute view for them. But maybe you have a good use case that 
involves interop with code that still make use of them?

-Alan.


More information about the nio-dev mailing list