com.jogamp.common.net.AssetURLStreamHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gluegen-rt-android Show documentation
Show all versions of gluegen-rt-android Show documentation
JNI binding generator (Android runtime)
package com.jogamp.common.net;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import com.jogamp.common.net.AssetURLConnection;
/**
* {@link URLStreamHandler} to handle the asset protocol.
*
*
* This is the asset URLStreamHandler variation
* for manual use.
*
*
* It requires passing a valid {@link AssetURLContext}
* for construction, hence it's not suitable for the pkg factory model.
*
*/
public class AssetURLStreamHandler extends URLStreamHandler {
AssetURLContext ctx;
public AssetURLStreamHandler(final AssetURLContext ctx) {
this.ctx = ctx;
}
@Override
protected URLConnection openConnection(final URL u) throws IOException {
final AssetURLConnection c = new AssetURLConnection(u, ctx);
c.connect();
return c;
}
}