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.privilegedGetProperty("user.home"); 106 Path userMimeTypes = Paths.get(userHome, ".mime.types"); 107 Path etcMimeTypes = Paths.get("/etc/mime.types"); 108 109 return chain(new MimeTypesFileTypeDetector(userMimeTypes), 110 new MimeTypesFileTypeDetector(etcMimeTypes)); 111 } 112 } | 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.privilegedGetProperty("user.home"); 106 Path userMimeTypes = Path.get(userHome, ".mime.types"); 107 Path etcMimeTypes = Path.get("/etc/mime.types"); 108 109 return chain(new MimeTypesFileTypeDetector(userMimeTypes), 110 new MimeTypesFileTypeDetector(etcMimeTypes)); 111 } 112 } |