/** * @param jarFileUri jar:file:/some/path/gluegen-rt.jar!/ * @param jarEntry com/jogamp/common/GlueGenVersion.class * @return jar:file:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class * @throws IllegalArgumentException null arguments * @throws URISyntaxException */ public static Uri getJarEntryUri(final Uri jarFileUri, final Uri.Encoded jarEntry) throws IllegalArgumentException, URISyntaxException { if (null == jarEntry) { throw new IllegalArgumentException("jarEntry is null"); } return Uri.cast(jarFileUri.toString() + jarEntry); }
/** * @param jarSubUriS file:/some/path/gluegen-rt.jar (Uri encoded) * @return jar:file:/some/path/gluegen-rt.jar!/ * @throws IllegalArgumentException null arguments * @throws URISyntaxException */ public static Uri getJarFileUri(final Uri.Encoded jarSubUriS) throws IllegalArgumentException, URISyntaxException { if (null == jarSubUriS) { throw new IllegalArgumentException("jarSubUriS is null"); } return Uri.cast(Uri.JAR_SCHEME + Uri.SCHEME_SEPARATOR + jarSubUriS + "!/"); }
/** * @param baseUri file:/some/path/ * @param jarFileName gluegen-rt.jar (Uri encoded) * @return jar:file:/some/path/gluegen-rt.jar!/ * @throws URISyntaxException * @throws IllegalArgumentException null arguments */ public static Uri getJarFileUri(final Uri baseUri, final Uri.Encoded jarFileName) throws IllegalArgumentException, URISyntaxException { if (null == baseUri || null == jarFileName) { throw new IllegalArgumentException( "null arguments: baseUri " + baseUri + ", jarFileName " + jarFileName); } return Uri.cast( Uri.JAR_SCHEME + Uri.SCHEME_SEPARATOR + baseUri.toString() + jarFileName + "!/"); }
/** * The Class's <code>"com.jogamp.common.GlueGenVersion"</code> Uri <code> * jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class" * </code> Jar file Uri <code>jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/</code> will be * returned. * * <p><i>sub_protocol</i> may be "file", "http", etc.. * * @param clazzBinName "com.jogamp.common.GlueGenVersion" * @param cl * @return "jar:<i>sub_protocol</i>:/some/path/gluegen-rt.jar!/" * @throws IllegalArgumentException if the Uri doesn't match the expected formatting or null * arguments * @throws IOException if the class's Jar file could not been found by the ClassLoader * @throws URISyntaxException if the Uri could not be translated into a RFC 2396 Uri * @see {@link IOUtil#getClassURL(String, ClassLoader)} */ public static Uri getJarFileUri(final String clazzBinName, final ClassLoader cl) throws IllegalArgumentException, IOException, URISyntaxException { if (null == clazzBinName || null == cl) { throw new IllegalArgumentException( "null arguments: clazzBinName " + clazzBinName + ", cl " + cl); } final Uri jarSubUri = getJarUri(clazzBinName, cl).getContainedUri(); final Uri uri = Uri.cast(Uri.JAR_SCHEME + Uri.SCHEME_SEPARATOR + jarSubUri.toString() + "!/"); if (DEBUG) { System.err.println("getJarFileUri res: " + uri); } return uri; }