diff options
author | Sven Gothel <[email protected]> | 2014-09-08 13:49:45 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-09-08 13:49:45 +0200 |
commit | 6a466e3f1e92a1e831ea61d1bb72c32f56b2a28d (patch) | |
tree | 35c8509454e940a1d751fa6121e51e510005445d /src/java/com/jogamp/common/util | |
parent | 3e50f103fa49b40f86966877084e0282a8d97ff8 (diff) |
Bug 1063: Further Uri completion - As a result of JOGL Uri adoption
Diffstat (limited to 'src/java/com/jogamp/common/util')
-rw-r--r-- | src/java/com/jogamp/common/util/IOUtil.java | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java index 3a09835..d9fb9cf 100644 --- a/src/java/com/jogamp/common/util/IOUtil.java +++ b/src/java/com/jogamp/common/util/IOUtil.java @@ -536,20 +536,6 @@ public class IOUtil { } /** - * Wraps {@link #getRelativeOf(URI, String)} for convenience. - * @param relativePath denotes a relative file to the baseLocation's parent directory (URI encoded) - * @throws IOException - * @deprecated Use {@link Uri#getRelativeOf(com.jogamp.common.net.Uri.Encoded)}. - */ - public static URL getRelativeOf(final URL baseURL, final String relativePath) throws IOException { - try { - return Uri.valueOf(baseURL).getRelativeOf(Uri.Encoded.cast(relativePath)).toURL(); - } catch (final URISyntaxException e) { - throw new IOException(e); - } - } - - /** * Generates a path for the 'relativeFile' relative to the 'baseLocation'. * * @param baseLocation denotes a directory @@ -620,30 +606,17 @@ public class IOUtil { public static final Pattern patternSpaceEnc = Pattern.compile("%20"); /** - * If <code>uri</code> is a <i>file scheme</i>, - * implementation completes space-decoding <i>[ "//"+{@link URI#getAuthority()} ] + {@link URI#getPath()}</i>.<br> - * Then it processes the <code>path</code> if {@link File#separatorChar} <code> == '\\'</code> - * as follows: - * <ul> - * <li>slash -> backslash</li> - * <li>drop a starting single backslash, preserving windows UNC</li> - * </ul> - * </p> + * If <code>uri</code> is a <i>file scheme</i> + * implementation returns {@link Uri#toFile()}.{@link File#getPath()}. * <p> * Otherwise it returns the {@link URI#toASCIIString()} encoded URI. * </p> - * @deprecated Use {@link Uri#toFile()} */ - public static String decodeURIIfFilePath(final java.net.URI uri) { - try { - final File file = Uri.valueOf(uri).toFile(); - if( null != file ) { - return file.getPath(); - } else { - return uri.toASCIIString(); - } - } catch (final URISyntaxException e) { - throw new RuntimeException(e); + public static String getUriFilePathOrASCII(final Uri uri) { + if( uri.isFileScheme() ) { + return uri.toFile().getPath(); + } else { + return uri.toASCIIString().get(); } } |