85 }
86
87 @Override
88 @SuppressWarnings("unchecked")
89 public <A extends BasicFileAttributes> A readAttributes(Path file,
90 Class<A> type,
91 LinkOption... options)
92 throws IOException
93 {
94 if (type == DosFileAttributes.class) {
95 DosFileAttributeView view =
96 getFileAttributeView(file, DosFileAttributeView.class, options);
97 return (A) view.readAttributes();
98 } else {
99 return super.readAttributes(file, type, options);
100 }
101 }
102
103 @Override
104 FileTypeDetector getFileTypeDetector() {
105 Path userMimeTypes = Paths.get(AccessController.doPrivileged(
106 new GetPropertyAction("user.home")), ".mime.types");
107 Path etcMimeTypes = Paths.get("/etc/mime.types");
108
109 return chain(new GioFileTypeDetector(),
110 new MimeTypesFileTypeDetector(userMimeTypes),
111 new MimeTypesFileTypeDetector(etcMimeTypes),
112 new MagicFileTypeDetector());
113 }
114 }
|
85 }
86
87 @Override
88 @SuppressWarnings("unchecked")
89 public <A extends BasicFileAttributes> A readAttributes(Path file,
90 Class<A> type,
91 LinkOption... options)
92 throws IOException
93 {
94 if (type == DosFileAttributes.class) {
95 DosFileAttributeView view =
96 getFileAttributeView(file, DosFileAttributeView.class, options);
97 return (A) view.readAttributes();
98 } else {
99 return super.readAttributes(file, type, options);
100 }
101 }
102
103 @Override
104 FileTypeDetector getFileTypeDetector() {
105 String userHome = GetPropertyAction.getProperty("user.home");
106 Path userMimeTypes = Paths.get(userHome, ".mime.types");
107 Path etcMimeTypes = Paths.get("/etc/mime.types");
108
109 return chain(new GioFileTypeDetector(),
110 new MimeTypesFileTypeDetector(userMimeTypes),
111 new MimeTypesFileTypeDetector(etcMimeTypes),
112 new MagicFileTypeDetector());
113 }
114 }
|