From 791a2749886f02ec7b8db25bf8862e8269b96da5 Mon Sep 17 00:00:00 2001
From: Harvey Harrison
* Note that the asset folder is not used on all platforms using the asset 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 asset URL, suitable even w/o the registered asset URLStreamHandler.
*
@@ -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 asset URL, suitable only with the registered asset URLStreamHandler.
*
@@ -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 asset handler previously set via {@link #registerHandler(ClassLoader)},
+ * Returns the asset 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 asset
- * The ClassLoader is required to find the asset resource
+ * The ClassLoader is required to find the asset resource
* via it's
@@ -123,33 +123,33 @@ public abstract class AssetURLContext implements PiggybackURLContext {
@Override
public String getImplementedProtocol() {
return asset_protocol;
- }
-
+ }
+
/**
* {@inheritDoc}
- *
+ *
* This implementation attempts to resolve asset
*/
public static final String asset_protocol = "asset";
-
+
/** The asset URL protocol prefix asset:
*/
public static final String asset_protocol_prefix = "asset:";
-
- /**
+
+ /**
* The optional asset folder name with ending slash assets/
.
* handler
for the given ClassLoader cl
.
- *
+ *
* @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 asset aware ClassLoader.
* URL findResource(String)
implementation.
* path
in the following order:
*
*
- * new URL(path)
, use sub-protocol if asset URLnew File(path).toURI().toURL()
*
* In case of using the ClassLoader (2) and if running on Android,
* the {@link #assets_folder} is being prepended to path
if missing.
- *