/** * 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. */ public URI toURI() { String name = getAbsoluteName(); try { if (!name.startsWith("/")) { // start with sep. return new URI("file", null, "/" + name, null, null); } else if (name.startsWith("//")) { return new URI("file", "", name, null); // UNC path } return new URI("file", null, name, null, null); } catch (URISyntaxException e) { // this should never happen return null; } }
/** * Returns a Uniform Resource Locator for this file. The URL is system * dependent and may not be transferable between different operating / file * systems. * * @return a URL for this file. * @throws java.net.MalformedURLException * if the path cannot be transformed into a URL. * @deprecated Use {@link #toURI} and {@link java.net.URI#toURL} to * correctly escape illegal characters. */ @Deprecated public URL toURL() throws java.net.MalformedURLException { String name = getAbsoluteName(); if (!name.startsWith("/")) { // start with sep. return new URL("file", "", -1, "/" + name, null); } else if (name.startsWith("//")) { return new URL("file:" + name); // UNC path } return new URL("file", "", -1, name, null); }
/** * 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. */ public URI toURI() { String name = getAbsoluteName(); try { if (!name.startsWith("/")) { // start with sep. return new URI("file", null, "/" + name, null, null); } else if (name.startsWith("//")) { return new URI("file", "", name, null); // UNC path } return new URI("file", null, name, null, null); } catch (URISyntaxException e) { // this should never happen return null; } }
/** * Returns a Uniform Resource Locator for this file. The URL is system * dependent and may not be transferable between different operating / file * systems. * * @return a URL for this file. * @throws java.net.MalformedURLException * if the path cannot be transformed into a URL. * @deprecated Use {@link #toURI} and {@link java.net.URI#toURL} to * correctly escape illegal characters. */ @Deprecated public URL toURL() throws java.net.MalformedURLException { String name = getAbsoluteName(); if (!name.startsWith("/")) { // start with sep. return new URL("file", "", -1, "/" + name, null); } else if (name.startsWith("//")) { return new URL("file:" + name); // UNC path } return new URL("file", "", -1, name, null); }
/** * 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. */ public URI toURI() { String name = getAbsoluteName(); try { if (!name.startsWith("/")) { // start with sep. return new URI("file", null, "/" + name, null, null); } else if (name.startsWith("//")) { return new URI("file", "", name, null); // UNC path } return new URI("file", null, name, null, null); } catch (URISyntaxException e) { // this should never happen return null; } }
/** * 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. */ public URI toURI() { String name = getAbsoluteName(); try { if (!name.startsWith("/")) { // start with sep. return new URI("file", null, "/" + name, null, null); } else if (name.startsWith("//")) { return new URI("file", "", name, null); // UNC path } return new URI("file", null, name, null, null); } catch (URISyntaxException e) { // this should never happen return null; } }
/** * Returns a Uniform Resource Locator for this file. The URL is system * dependent and may not be transferable between different operating / file * systems. * * @return a URL for this file. * @throws java.net.MalformedURLException * if the path cannot be transformed into a URL. * @deprecated Use {@link #toURI} and {@link java.net.URI#toURL} to * correctly escape illegal characters. */ @Deprecated public URL toURL() throws java.net.MalformedURLException { String name = getAbsoluteName(); if (!name.startsWith("/")) { // start with sep. return new URL("file", "", -1, "/" + name, null); } else if (name.startsWith("//")) { return new URL("file:" + name); // UNC path } return new URL("file", "", -1, name, null); }
/** * 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. */ public URI toURI() { String name = getAbsoluteName(); try { if (!name.startsWith("/")) { // start with sep. return new URI("file", null, "/" + name, null, null); } else if (name.startsWith("//")) { return new URI("file", "", name, null); // UNC path } return new URI("file", null, name, null, null); } catch (URISyntaxException e) { // this should never happen return null; } }
/** * 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. */ public URI toURI() { String name = getAbsoluteName(); try { if (!name.startsWith("/")) { // start with sep. return new URI("file", null, "/" + name, null, null); } else if (name.startsWith("//")) { return new URI("file", "", name, null); // UNC path } return new URI("file", null, name, null, null); } catch (URISyntaxException e) { // this should never happen return null; } }
/** * Returns a Uniform Resource Locator for this file. The URL is system * dependent and may not be transferable between different operating / file * systems. * * @return a URL for this file. * @throws java.net.MalformedURLException * if the path cannot be transformed into a URL. * @deprecated Use {@link #toURI} and {@link java.net.URI#toURL} to * correctly escape illegal characters. */ @Deprecated public URL toURL() throws java.net.MalformedURLException { String name = getAbsoluteName(); if (!name.startsWith("/")) { // start with sep. return new URL("file", "", -1, "/" + name, null); } else if (name.startsWith("//")) { return new URL("file:" + name); // UNC path } return new URL("file", "", -1, name, null); }
/** * Returns a Uniform Resource Locator for this file. The URL is system * dependent and may not be transferable between different operating / file * systems. * * @return a URL for this file. * @throws java.net.MalformedURLException * if the path cannot be transformed into a URL. * @deprecated Use {@link #toURI} and {@link java.net.URI#toURL} to * correctly escape illegal characters. */ @Deprecated public URL toURL() throws java.net.MalformedURLException { String name = getAbsoluteName(); if (!name.startsWith("/")) { // start with sep. return new URL("file", "", -1, "/" + name, null); } else if (name.startsWith("//")) { return new URL("file:" + name); // UNC path } return new URL("file", "", -1, name, null); }
/** * Returns a Uniform Resource Locator for this file. The URL is system * dependent and may not be transferable between different operating / file * systems. * * @return a URL for this file. * @throws java.net.MalformedURLException * if the path cannot be transformed into a URL. * @deprecated Use {@link #toURI} and {@link java.net.URI#toURL} to * correctly escape illegal characters. */ @Deprecated public URL toURL() throws java.net.MalformedURLException { String name = getAbsoluteName(); if (!name.startsWith("/")) { // start with sep. return new URL("file", "", -1, "/" + name, null); } else if (name.startsWith("//")) { return new URL("file:" + name); // UNC path } return new URL("file", "", -1, name, null); }
/** * Returns a Uniform Resource Locator for this file. The URL is system * dependent and may not be transferable between different operating / file * systems. * * @return a URL for this file. * @throws java.net.MalformedURLException * if the path cannot be transformed into a URL. * @deprecated Use {@link #toURI} and {@link java.net.URI#toURL} to * correctly escape illegal characters. */ @Deprecated public URL toURL() throws java.net.MalformedURLException { String name = getAbsoluteName(); if (!name.startsWith("/")) { // start with sep. return new URL("file", "", -1, "/" + name, null); } else if (name.startsWith("//")) { return new URL("file:" + name); // UNC path } return new URL("file", "", -1, name, null); }
/** * 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. */ public URI toURI() { String name = getAbsoluteName(); try { if (!name.startsWith("/")) { // start with sep. return new URI("file", null, "/" + name, null, null); } else if (name.startsWith("//")) { return new URI("file", "", name, null); // UNC path } return new URI("file", null, name, null, null); } catch (URISyntaxException e) { // this should never happen return null; } }