streamHandler = new JarHandler();
throw new NullPointerException(e.toString()); setURL(url, "jar", "", -1, null, null, file, null, null);
public static void main(String args[]){ ClassPool pool = ClassPool.getDefault(); pool.insertClassPath( "c:/Test.jar" ); CtClass cc = pool.get("com.test.TestFunction"); CtMethod m = CtNewMethod.make("public void test2() { System.out.println(\"test2\"); }", cc); cc.addMethod(m); CtMethod cm = cc.getDeclaredMethod("test1", new CtClass[0]); cm.insertBefore("{ test2();}"); byte[] b = cc.toBytecode(); // convert the new class to bytecode. pool.removeClassPath(cp); // need to remove the classpath to release connection to JAR file so we can update it. JarHandler jarHandler = new JarHandler(); jarHandler.replaceJarFile("C:/Test.jar", b, "com/test/TestFunction.class"); }
if (protocol.equals("file")) { streamHandler = new FileHandler(); } else if (protocol.equals("ftp")) { streamHandler = new FtpHandler(); } else if (protocol.equals("http")) { try { String name = "com.android.okhttp.HttpHandler"; streamHandler = (URLStreamHandler) Class.forName(name).newInstance(); } catch (Exception e) { throw new AssertionError(e); } } else if (protocol.equals("https")) { try { String name = "com.android.okhttp.HttpsHandler"; streamHandler = (URLStreamHandler) Class.forName(name).newInstance(); } catch (Exception e) { throw new AssertionError(e); } } else if (protocol.equals("jar")) { streamHandler = new JarHandler(); } if (streamHandler != null) { streamHandlers.put(protocol, streamHandler); }
throw new NullPointerException(e.toString()); setURL(url, "jar", "", -1, null, null, file, null, null);
streamHandler = new JarHandler();
throw new NullPointerException(e.toString()); setURL(url, "jar", "", -1, null, null, file, null, null);
streamHandler = new JarHandler();
throw new NullPointerException(e.toString()); setURL(url, "jar", "", -1, null, null, file, null, null);
streamHandler = new JarHandler();
throw new NullPointerException(e.toString()); setURL(url, "jar", "", -1, null, null, file, null, null);
streamHandler = new JarHandler();
throw new NullPointerException(e.toString()); setURL(url, "jar", "", -1, null, null, file, null, null);
streamHandler = new JarHandler();
throw new NullPointerException(e.toString()); setURL(url, "jar", "", -1, null, null, file, null, null);
streamHandler = new JarHandler();