MCPcopy Create free account
hub / github.com/davidgiven/luje / toURI

Method toURI

lib/java/io/File.java:1421–1438  ·  view source on GitHub ↗

Returns a Uniform Resource Identifier for this file. The URI is system dependent and may not be transferable between different operating / file systems. @return an URI for this file.

()

Source from the content-addressed store, hash-verified

1419 * @return an URI for this file.
1420 */
1421 @SuppressWarnings("nls")
1422 public URI toURI() {
1423 String name = getAbsoluteName();
1424 try {
1425 if (!name.startsWith("/")) {
1426 // start with sep.
1427 return new URI("file", null, new StringBuilder(
1428 name.length() + 1).append('/').append(name).toString(),
1429 null, null);
1430 } else if (name.startsWith("//")) {
1431 return new URI("file", "", name, null); // UNC path
1432 }
1433 return new URI("file", null, name, null, null);
1434 } catch (URISyntaxException e) {
1435 // this should never happen
1436 return null;
1437 }
1438 }
1439
1440 /**
1441 * Returns a Uniform Resource Locator for this file. The URL is system

Callers

nothing calls this directly

Calls 5

getAbsoluteNameMethod · 0.95
startsWithMethod · 0.95
lengthMethod · 0.95
toStringMethod · 0.65
appendMethod · 0.65

Tested by

no test coverage detected