summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/net/AssetURLContext.java
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2013-10-17 21:06:56 -0700
committerHarvey Harrison <[email protected]>2013-10-17 21:06:56 -0700
commit791a2749886f02ec7b8db25bf8862e8269b96da5 (patch)
treec9be31d0bbbe8033b4a6a0cfad91a22b6575ced1 /src/java/com/jogamp/common/net/AssetURLContext.java
parent5b77e15500b7b19d35976603dd71e8b997b2d8ea (diff)
gluegen: remove trailing whitespace
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/java/com/jogamp/common/net/AssetURLContext.java')
-rw-r--r--src/java/com/jogamp/common/net/AssetURLContext.java60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/java/com/jogamp/common/net/AssetURLContext.java b/src/java/com/jogamp/common/net/AssetURLContext.java
index 470530e..38691e8 100644
--- a/src/java/com/jogamp/common/net/AssetURLContext.java
+++ b/src/java/com/jogamp/common/net/AssetURLContext.java
@@ -17,14 +17,14 @@ import com.jogamp.common.util.IOUtil;
*/
public abstract class AssetURLContext implements PiggybackURLContext {
private static final boolean DEBUG = IOUtil.DEBUG;
-
+
/** The <i>asset URL</i> protocol name <code>asset</code> */
public static final String asset_protocol = "asset";
-
+
/** The <i>asset URL</i> protocol prefix <code>asset:</code> */
public static final String asset_protocol_prefix = "asset:";
-
- /**
+
+ /**
* The <i>optional</i> <i>asset</i> folder name with ending slash <code>assets/</code>.
* <p>
* Note that the <i>asset</i> folder is not used on all platforms using the <i>asset</i> protocol
@@ -41,11 +41,11 @@ public abstract class AssetURLContext implements PiggybackURLContext {
}
};
}
-
+
public static AssetURLStreamHandler createHandler(final ClassLoader cl) {
return new AssetURLStreamHandler(create(cl));
}
-
+
/**
* Create an <i>asset</i> URL, suitable even w/o the registered <i>asset</i> URLStreamHandler.
* <p>
@@ -62,7 +62,7 @@ public abstract class AssetURLContext implements PiggybackURLContext {
public static URL createURL(String path, ClassLoader cl) throws MalformedURLException {
return new URL(null, path.startsWith(asset_protocol_prefix) ? path : asset_protocol_prefix + path, createHandler(cl));
}
-
+
/**
* Create an <i>asset</i> URL, suitable only with the registered <i>asset</i> URLStreamHandler.
* <p>
@@ -78,20 +78,20 @@ public abstract class AssetURLContext implements PiggybackURLContext {
public static URL createURL(String path) throws MalformedURLException {
return new URL(path.startsWith(asset_protocol_prefix) ? path : asset_protocol_prefix + path);
}
-
+
/**
- * Returns the <i>asset</i> handler previously set via {@link #registerHandler(ClassLoader)},
+ * Returns the <i>asset</i> handler previously set via {@link #registerHandler(ClassLoader)},
* or null if none was set.
*/
public static URLStreamHandler getRegisteredHandler() {
final GenericURLStreamHandlerFactory f = GenericURLStreamHandlerFactory.register();
return ( null != f ) ? f.getHandler(asset_protocol) : null;
}
-
+
/**
- * Registers the generic URLStreamHandlerFactory via {@link GenericURLStreamHandlerFactory#register()}
+ * Registers the generic URLStreamHandlerFactory via {@link GenericURLStreamHandlerFactory#register()}
* and if successful sets the <i>asset</i> <code>handler</code> for the given ClassLoader <code>cl</code>.
- *
+ *
* @return true if successful, otherwise false
*/
public static boolean registerHandler(ClassLoader cl) {
@@ -103,11 +103,11 @@ public abstract class AssetURLContext implements PiggybackURLContext {
return false;
}
}
-
- /**
+
+ /**
* Returns an <i>asset</i> aware ClassLoader.
* <p>
- * The ClassLoader is required to find the <i>asset</i> resource
+ * The ClassLoader is required to find the <i>asset</i> resource
* via it's <code>URL findResource(String)</code> implementation.
* </p>
* <p>
@@ -123,33 +123,33 @@ public abstract class AssetURLContext implements PiggybackURLContext {
@Override
public String getImplementedProtocol() {
return asset_protocol;
- }
-
+ }
+
/**
* {@inheritDoc}
- * <p>
+ * <p>
* This implementation attempts to resolve <code>path</code> in the following order:
* <ol>
* <li> as a valid URL: <code>new URL(path)</code>, use sub-protocol if <i>asset</i> URL</li>
* <li> via ClassLoader: {@link #getClassLoader()}.{@link ClassLoader#getResource(String) getResource(path)}, use sub-protocol if <i>asset</i> URL </li>
* <li> as a File: <code>new File(path).toURI().toURL()</code>
* </ol>
- * </p>
+ * </p>
* <p>
* In case of using the ClassLoader (2) <b>and</b> if running on Android,
* the {@link #assets_folder} is being prepended to <code>path</code> if missing.
- * </p>
- **/
+ * </p>
+ **/
@Override
public URLConnection resolve(String path) throws IOException {
return resolve(path, getClassLoader());
}
-
+
public static URLConnection resolve(String path, ClassLoader cl) throws IOException {
URL url = null;
URLConnection conn = null;
int type = -1;
-
+
if(DEBUG) {
System.err.println("AssetURLContext.resolve: <"+path+">");
}
@@ -158,14 +158,14 @@ public abstract class AssetURLContext implements PiggybackURLContext {
} catch (URISyntaxException uriEx) {
throw new IOException(uriEx);
}
-
+
try {
// lookup as valid sub-protocol
url = new URL(path);
conn = open(url);
type = null != conn ? 1 : -1;
} catch(MalformedURLException e1) { if(DEBUG) { System.err.println("ERR(0): "+e1.getMessage()); } }
-
+
if(null == conn && null != cl) {
// lookup via ClassLoader .. cleanup leading '/'
String cpath = path;
@@ -179,7 +179,7 @@ public abstract class AssetURLContext implements PiggybackURLContext {
conn = open(url);
type = null != conn ? 2 : -1;
}
-
+
if(null == conn) {
// lookup as File
try {
@@ -191,7 +191,7 @@ public abstract class AssetURLContext implements PiggybackURLContext {
}
} catch (Throwable e) { if(DEBUG) { System.err.println("ERR(1): "+e.getMessage()); } }
}
-
+
if(DEBUG) {
System.err.println("AssetURLContext.resolve: type "+type+": url <"+url+">, conn <"+conn+">, connURL <"+(null!=conn?conn.getURL():null)+">");
}
@@ -200,7 +200,7 @@ public abstract class AssetURLContext implements PiggybackURLContext {
}
return conn;
}
-
+
private static URLConnection open(URL url) {
if(null==url) {
return null;
@@ -209,8 +209,8 @@ public abstract class AssetURLContext implements PiggybackURLContext {
final URLConnection c = url.openConnection();
c.connect(); // redundant
return c;
- } catch (IOException ioe) { if(DEBUG) { System.err.println("ERR: "+ioe.getMessage()); } }
+ } catch (IOException ioe) { if(DEBUG) { System.err.println("ERR: "+ioe.getMessage()); } }
return null;
}
-
+
}