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.
()
| 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 |
nothing calls this directly
no test coverage detected