Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- URLClassLoader sysloader = (URLClassLoader) ClassLoader
- .getSystemClassLoader();
- Class<URLClassLoader> sysclass = URLClassLoader.class;
- Method method = sysclass.getDeclaredMethod("addURL", parameters);
- method.setAccessible(true);
- method.invoke(sysloader, (Object[]) urls);
- public static int getContentLength (URL url)
- throws IOException
- {
- String contentLength = url.openConnection().getHeaderField("Content-Length");
- if (contentLength == null) {
- throw new IllegalArgumentException(url + " didn't have a "
- + "Content-Length header");
- } else {
- return Integer.parseInt(contentLength);
- }
- }
Add Comment
Please, Sign In to add comment