1 7 8 package java.io; 9 10 11 14 15 abstract class FileSystem { 16 17 21 public static native FileSystem getFileSystem(); 22 23 24 25 26 29 public abstract char getSeparator(); 30 31 34 public abstract char getPathSeparator(); 35 36 40 public abstract String normalize(String path); 41 42 46 public abstract int prefixLength(String path); 47 48 53 public abstract String resolve(String parent, String child); 54 55 60 public abstract String getDefaultParent(); 61 62 68 public abstract String fromURIPath(String path); 69 70 71 72 73 76 public abstract boolean isAbsolute(File f); 77 78 82 public abstract String resolve(File f); 83 84 public abstract String canonicalize(String path) throws IOException ; 85 86 87 88 89 90 public static final int BA_EXISTS = 0x01; 91 public static final int BA_REGULAR = 0x02; 92 public static final int BA_DIRECTORY = 0x04; 93 public static final int BA_HIDDEN = 0x08; 94 95 100 public abstract int getBooleanAttributes(File f); 101 102 110 public abstract boolean checkAccess(File f, boolean write); 111 112 117 public abstract long getLastModifiedTime(File f); 118 119 124 public abstract long getLength(File f); 125 126 127 128 129 135 public abstract boolean createFileExclusively(String pathname) 136 throws IOException ; 137 138 142 public abstract boolean delete(File f); 143 144 149 public abstract boolean deleteOnExit(File f); 150 151 156 public abstract String [] list(File f); 157 158 162 public abstract boolean createDirectory(File f); 163 164 169 public abstract boolean rename(File f1, File f2); 170 171 176 public abstract boolean setLastModifiedTime(File f, long time); 177 178 183 public abstract boolean setReadOnly(File f); 184 185 186 187 188 191 public abstract File [] listRoots(); 192 193 194 195 196 199 public abstract int compare(File f1, File f2); 200 201 204 public abstract int hashCode(File f); 205 206 static boolean useCanonCaches = true; 209 static boolean useCanonPrefixCache = true; 210 211 private static boolean getBooleanProperty(String prop, boolean defaultVal) { 212 String val = System.getProperty(prop); 213 if (val == null) return defaultVal; 214 if (val.equalsIgnoreCase("true")) { 215 return true; 216 } else { 217 return false; 218 } 219 } 220 221 static { 222 useCanonCaches = getBooleanProperty("sun.io.useCanonCaches", 223 useCanonCaches); 224 useCanonPrefixCache = getBooleanProperty("sun.io.useCanonPrefixCache", 225 useCanonPrefixCache); 226 } 227 } 228 | Popular Tags |