summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/net
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
parent5b77e15500b7b19d35976603dd71e8b997b2d8ea (diff)
gluegen: remove trailing whitespace
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/java/com/jogamp/common/net')
-rw-r--r--src/java/com/jogamp/common/net/AssetURLConnection.java42
-rw-r--r--src/java/com/jogamp/common/net/AssetURLContext.java60
-rw-r--r--src/java/com/jogamp/common/net/AssetURLStreamHandler.java16
-rw-r--r--src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java12
-rw-r--r--src/java/com/jogamp/common/net/PiggybackURLConnection.java26
-rw-r--r--src/java/com/jogamp/common/net/PiggybackURLContext.java10
-rw-r--r--src/java/com/jogamp/common/net/asset/Handler.java12
7 files changed, 89 insertions, 89 deletions
diff --git a/src/java/com/jogamp/common/net/AssetURLConnection.java b/src/java/com/jogamp/common/net/AssetURLConnection.java
index f2a5a01..4f2a412 100644
--- a/src/java/com/jogamp/common/net/AssetURLConnection.java
+++ b/src/java/com/jogamp/common/net/AssetURLConnection.java
@@ -6,31 +6,31 @@ import java.net.URL;
/**
* See base class {@link PiggybackURLConnection} for motivation.
- *
+ *
* <p>
* <i>asset</i> resource location protocol connection.
* </p>
- *
+ *
* <p>
* See {@link AssetURLContext#resolve(String)} how resources are being resolved.
* </p>
*
* <h3>Example:</h3>
- *
+ *
* Assuming the plain <i>asset entry</i> <b><code>test/lala.txt</code></b> is being resolved by
* a class <code>test.LaLaTest</code>, ie. using the <i>asset aware</i> ClassLoader,
- * one would use the following <i>asset</i> aware filesystem layout:
- *
+ * one would use the following <i>asset</i> aware filesystem layout:
+ *
* <pre>
* test/LaLaTest.class
* assets/test/lala.txt
* </pre>
- *
- * The above maybe on a plain filesystem, or within a JAR or an APK file,
+ *
+ * The above maybe on a plain filesystem, or within a JAR or an APK file,
* e.g. <code>jogamp.test.apk</code>.
- *
+ *
* The above would result in the following possible URLs
- * reflecting the plain and resolved state of the <i>asset URL</i>:
+ * reflecting the plain and resolved state of the <i>asset URL</i>:
* <pre>
* 0 Entry test/lala.txt
* 1 Plain asset:test/lala.txt
@@ -38,16 +38,16 @@ import java.net.URL;
* </pre>
*
* <p>
- * The sub protocol URL of the resolved <i>asset</i>
+ * The sub protocol URL of the resolved <i>asset</i>
* <pre>
* 3 Sub-URL jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt
* </pre>
* can be retrieved using {@link #getSubProtocol()}.
* </p>
- *
+ *
* In all above cases, the <i>asset entry</i> is <b><code>test/lala.txt</code></b>,
* which can be retrieved via {@link #getEntryName()}.
- *
+ *
* <p>
* <h3>General Implementation Notes:</h3>
* An <i>asset</i> URL is resolved using {@link AssetURLContext#getClassLoader()}.{@link ClassLoader#getResource(String) getResource(String)},
@@ -56,43 +56,43 @@ import java.net.URL;
* </p>
* <p>
* <h3>Warning:</h3>
- * Since the <i>asset</i> protocol is currently not being implemented
+ * Since the <i>asset</i> protocol is currently not being implemented
* on all platform with an appropriate ClassLoader, a user shall not create the <i>asset</i> URL manually.<br>
* </p>
- *
+ *
* <h3>Android Implementation Notes:</h3>
* <p>
- * The Android ClassLoader {@link jogamp.android.launcher.AssetDexClassLoader}
+ * The Android ClassLoader {@link jogamp.android.launcher.AssetDexClassLoader}
* resolves the resource as an <i>asset</i> URL in it's {@link ClassLoader#findResource(String)} implementation.</p>
* <p>
- * Currently we attach our <i>asset</i> {@link java.net.URLStreamHandlerFactory}
+ * Currently we attach our <i>asset</i> {@link java.net.URLStreamHandlerFactory}
* to allow {@link java.net.URL} to handle <i>asset</i> URLs via our <i>asset</i> {@link java.net.URLStreamHandler} implementation.
* </p>
*/
public class AssetURLConnection extends PiggybackURLConnection<AssetURLContext> {
-
+
public AssetURLConnection(URL url, AssetURLContext implHelper) {
super(url, implHelper);
}
-
+
@Override
public String getEntryName() throws IOException {
if(!connected) {
throw new IOException("not connected");
}
-
+
final String urlPath ;
if(subConn instanceof JarURLConnection) {
urlPath = ((JarURLConnection)subConn).getEntryName();
} else {
urlPath = subConn.getURL().getPath();
}
-
+
if(urlPath.startsWith(AssetURLContext.assets_folder)) {
return urlPath.substring(AssetURLContext.assets_folder.length());
} else {
return urlPath;
}
}
-
+
}
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;
}
-
+
}
diff --git a/src/java/com/jogamp/common/net/AssetURLStreamHandler.java b/src/java/com/jogamp/common/net/AssetURLStreamHandler.java
index 8d95b2d..6760646 100644
--- a/src/java/com/jogamp/common/net/AssetURLStreamHandler.java
+++ b/src/java/com/jogamp/common/net/AssetURLStreamHandler.java
@@ -7,31 +7,31 @@ import java.net.URLStreamHandler;
import com.jogamp.common.net.AssetURLConnection;
-/**
+/**
* {@link URLStreamHandler} to handle the asset protocol.
- *
+ *
* <p>
* This is the <i>asset</i> URLStreamHandler variation
- * for manual use.
+ * for manual use.
* </p>
* <p>
* It requires passing a valid {@link AssetURLContext}
* for construction, hence it's not suitable for the pkg factory model.
* </p>
*/
-public class AssetURLStreamHandler extends URLStreamHandler {
+public class AssetURLStreamHandler extends URLStreamHandler {
AssetURLContext ctx;
-
+
public AssetURLStreamHandler(AssetURLContext ctx) {
this.ctx = ctx;
}
-
+
@Override
protected URLConnection openConnection(URL u) throws IOException {
final AssetURLConnection c = new AssetURLConnection(u, ctx);
c.connect();
return c;
}
-
-
+
+
}
diff --git a/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java b/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java
index 79d7f71..4ec3f19 100644
--- a/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java
+++ b/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java
@@ -10,30 +10,30 @@ import java.util.Map;
public class GenericURLStreamHandlerFactory implements URLStreamHandlerFactory {
private static GenericURLStreamHandlerFactory factory = null;
-
+
private final Map<String, URLStreamHandler> protocolHandlers;
private GenericURLStreamHandlerFactory() {
protocolHandlers = new HashMap<String, URLStreamHandler>();
}
-
+
/**
* Sets the <code>handler</code> for <code>protocol</code>.
- *
+ *
* @return the previous set <code>handler</code>, or null if none was set.
*/
public synchronized final URLStreamHandler setHandler(String protocol, URLStreamHandler handler) {
return protocolHandlers.put(protocol, handler);
}
-
+
/**
- * Returns the <code>protocol</code> handler previously set via {@link #setHandler(String, URLStreamHandler)},
+ * Returns the <code>protocol</code> handler previously set via {@link #setHandler(String, URLStreamHandler)},
* or null if none was set.
*/
public synchronized final URLStreamHandler getHandler(String protocol) {
return protocolHandlers.get(protocol);
}
-
+
@Override
public synchronized final URLStreamHandler createURLStreamHandler(String protocol) {
return getHandler(protocol);
diff --git a/src/java/com/jogamp/common/net/PiggybackURLConnection.java b/src/java/com/jogamp/common/net/PiggybackURLConnection.java
index 39f1637..3b774e8 100644
--- a/src/java/com/jogamp/common/net/PiggybackURLConnection.java
+++ b/src/java/com/jogamp/common/net/PiggybackURLConnection.java
@@ -6,10 +6,10 @@ import java.net.URL;
import java.net.URLConnection;
/**
- * Generic resource location protocol connection,
+ * Generic resource location protocol connection,
* using another sub-protocol as the vehicle for a piggyback protocol.
* <p>
- * The details of the sub-protocol can be queried using {@link #getSubProtocol()}.
+ * The details of the sub-protocol can be queried using {@link #getSubProtocol()}.
* </p>
* <p>
* See example in {@link AssetURLConnection}.
@@ -19,7 +19,7 @@ public abstract class PiggybackURLConnection<I extends PiggybackURLContext> exte
protected URL subUrl;
protected URLConnection subConn;
protected I context;
-
+
/**
* @param url the specific URL for this instance
* @param context the piggyback context, defining state independent code and constants
@@ -34,18 +34,18 @@ public abstract class PiggybackURLConnection<I extends PiggybackURLContext> exte
* Resolves the URL via {@link PiggybackURLContext#resolve(String)},
* see {@link AssetURLContext#resolve(String)} for an example.
* </p>
- *
+ *
* {@inheritDoc}
*/
@Override
public synchronized void connect() throws IOException {
if(!connected) {
- subConn = context.resolve(url.getPath());
- subUrl = subConn.getURL();
+ subConn = context.resolve(url.getPath());
+ subUrl = subConn.getURL();
connected = true;
}
}
-
+
@Override
public InputStream getInputStream() throws IOException {
if(!connected) {
@@ -53,26 +53,26 @@ public abstract class PiggybackURLConnection<I extends PiggybackURLContext> exte
}
return subConn.getInputStream();
}
-
- /**
+
+ /**
* Returns the <i>entry name</i> of the asset.
* <pre>
* Plain asset:test/lala.txt
* Resolved asset:jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt
* Result test/lala.txt
- * </pre>
+ * </pre>
* @throws IOException is not connected
**/
public abstract String getEntryName() throws IOException;
-
- /**
+
+ /**
* Returns the resolved <i>sub protocol</i> of the asset or null, ie:
* <pre>
* Plain asset:test/lala.txt
* Resolved asset:jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt
* Result jar:file:/data/app/jogamp.test.apk!/assets/test/lala.txt
* </pre>
- *
+ *
* @throws IOException is not connected
*/
public URL getSubProtocol() throws IOException {
diff --git a/src/java/com/jogamp/common/net/PiggybackURLContext.java b/src/java/com/jogamp/common/net/PiggybackURLContext.java
index 2cb48b5..9e3db69 100644
--- a/src/java/com/jogamp/common/net/PiggybackURLContext.java
+++ b/src/java/com/jogamp/common/net/PiggybackURLContext.java
@@ -8,11 +8,11 @@ import java.net.URLConnection;
*/
public interface PiggybackURLContext {
- /** Returns the specific protocol, constant for this implementation. */
+ /** Returns the specific protocol, constant for this implementation. */
public String getImplementedProtocol();
-
- /**
- * Resolving path to a URL sub protocol and return it's open URLConnection
+
+ /**
+ * Resolving path to a URL sub protocol and return it's open URLConnection
**/
- public URLConnection resolve(String path) throws IOException;
+ public URLConnection resolve(String path) throws IOException;
}
diff --git a/src/java/com/jogamp/common/net/asset/Handler.java b/src/java/com/jogamp/common/net/asset/Handler.java
index 1063797..d622221 100644
--- a/src/java/com/jogamp/common/net/asset/Handler.java
+++ b/src/java/com/jogamp/common/net/asset/Handler.java
@@ -8,12 +8,12 @@ import java.net.URLStreamHandler;
import com.jogamp.common.net.AssetURLConnection;
import com.jogamp.common.net.AssetURLContext;
-/**
+/**
* {@link URLStreamHandler} to handle the asset protocol.
- *
+ *
* <p>
* This is the <i>asset</i> URLStreamHandler variation
- * using this class ClassLoader for the pkg factory model.
+ * using this class ClassLoader for the pkg factory model.
* </p>
*/
public class Handler extends URLStreamHandler {
@@ -23,16 +23,16 @@ public class Handler extends URLStreamHandler {
return Handler.class.getClassLoader();
}
};
-
+
public Handler() {
super();
}
-
+
@Override
protected URLConnection openConnection(URL u) throws IOException {
final AssetURLConnection c = new AssetURLConnection(u, localCL);
c.connect();
return c;
}
-
+
}