Lines Matching refs:path

43             new GetPropertyAction("path.separator")).charAt(0);
74 the length of the prefix almost uniquely identifies the type of the path
84 private int normalizePrefix(String path, int len, StringBuffer sb) {
86 while ((src < len) && isSlash(path.charAt(src))) src++;
89 && isLetter(c = path.charAt(src))
90 && path.charAt(src + 1) == ':') {
93 specifiers (e.g., "file://c:/path"). As a side effect,
94 "/c:/path" can be used as an alternative to "c:/path". */
101 && isSlash(path.charAt(0))
102 && isSlash(path.charAt(1))) {
117 private String normalize(String path, int len, int off) {
118 if (len == 0) return path;
126 src = normalizePrefix(path, len, sb);
130 sb.append(path.substring(0, off));
133 /* Remove redundant slashes from the remainder of the path, forcing all
136 char c = path.charAt(src++);
138 while ((src < len) && isSlash(path.charAt(src))) src++;
181 public String normalize(String path) {
182 int n = path.length();
187 char c = path.charAt(i);
189 return normalize(path, n, (prev == slash) ? i - 1 : i);
191 return normalize(path, n, i - 1);
193 return normalize(path, n, 0);
196 if (prev == slash) return normalize(path, n, n - 1);
197 return path;
200 public int prefixLength(String path) {
202 int n = path.length();
204 char c0 = path.charAt(0);
205 char c1 = (n > 1) ? path.charAt(1) : 0;
211 if ((n > 2) && (path.charAt(2) == slash))
266 public String fromURIPath(String path) {
267 String p = path;
317 private String getDrive(String path) {
318 int pl = prefixLength(path);
319 return (pl == 3) ? path.substring(0, 2) : null;
323 String path = f.getPath();
325 if ((pl == 2) && (path.charAt(0) == slash))
326 return path; /* UNC */
328 return path; /* Absolute local */
330 return getUserPath() + slashify(path); /* Completely relative */
334 if (ud != null) return ud + path;
335 return up + path; /* User dir is a UNC path */
340 if ((ud != null) && path.startsWith(ud))
341 return up + slashify(path.substring(2));
342 char drive = path.charAt(0);
346 /* When resolving a directory-relative path that refers to a
349 String p = drive + (':' + dir + slashify(path.substring(2)));
355 throw new SecurityException("Cannot resolve path " + path);
359 return drive + ":" + slashify(path.substring(2)); /* fake it */
361 throw new InternalError("Unresolvable path: " + path);
365 // The first cache handles repeated canonicalizations of the same path
369 // prefix cache is conservative and is not used for complex path names.
373 public String canonicalize(String path) throws IOException {
374 // If path is a drive letter only then skip canonicalization
375 int len = path.length();
377 (isLetter(path.charAt(0))) &&
378 (path.charAt(1) == ':')) {
379 char c = path.charAt(0);
381 return path;
384 (isLetter(path.charAt(0))) &&
385 (path.charAt(1) == ':') &&
386 (path.charAt(2) == '\\')) {
387 char c = path.charAt(0);
389 return path;
393 return canonicalize0(path);
395 String res = cache.get(path);
400 dir = parentOrNull(path);
404 // Hit only in prefix cache; full path is canonical,
407 String filename = path.substring(1 + dir.length());
414 res = canonicalize0(path);
415 cache.put(path, res);
431 protected native String canonicalize0(String path)
441 // the canonical name of the last element of the path
445 // Best-effort attempt to get parent of this path; used for
452 static String parentOrNull(String path) {
453 if (path == null) return null;
456 int last = path.length() - 1;
461 char c = path.charAt(idx);
478 path.charAt(idx - 1) == sep ||
479 path.charAt(idx - 1) == altSep) {
484 return path.substring(0, idx);
512 public native boolean createFileExclusively(String path)
544 private boolean access(String path) {
547 if (security != null) security.checkRead(path);