public Resource(String name, URL url) throws IOException { URLConnection conn = url.openConnection(); this.name = name; this.timestamp = conn.getLastModified(); this.content = Utils.readAsBytes(conn.getInputStream()); }
Iterator<Resource> getResources() throws IOException { Iterator<InputStream> i = driver.open(handle); if (i.hasNext()) { LinkedList<Resource> resources = new LinkedList<Resource>(); while (i.hasNext()) { InputStream in = i.next(); byte[] bytes = Utils.readAsBytes(in); long lastModified = getLastModified(); resources.add(new Resource(name, bytes, lastModified)); } return resources.iterator(); } else { return Utils.iterator(); } }
Resource getResource() throws IOException { InputStream in = open(); byte[] bytes = Utils.readAsBytes(in); long lastModified = getLastModified(); return new Resource(name, bytes, lastModified); }
assertTrue(tmp.delete()); war.as(ZipExporter.class).exportTo(tmp); final byte[] bytes = Utils.readAsBytes(jar.get("foo/A.class").getAsset().openStream()); return new ClassLoader(Thread.currentThread().getContextClassLoader()) { Class<?> aClass = null;
public void testNestedJar() throws Exception { // URLDriver driver = new URLDriver(); driver.merge(new URL("jar:" + warFile.toURI().toURL() + "!/WEB-INF/")); Node root = driver.root(); Node lib = driver.child(root, "lib"); Node foo_jar = driver.child(lib, "foo.jar"); assertNotNull(foo_jar); Iterator<InputStream> in = driver.open(foo_jar); assertNotNull(in); assertTrue(in.hasNext()); byte[] bytes = Utils.readAsBytes(in.next()); assertFalse(in.hasNext()); // URL url = new URL("jar:jar:" + warFile.toURI().toURL() + "!/WEB-INF/lib/foo.jar!/org/crsh/"); driver = new URLDriver(); driver.merge(url); root = driver.root(); Node vfs = driver.child(root, "vfs"); Node FSTestCase_class = driver.child(vfs, "FSTestCase.class"); assertNotNull(FSTestCase_class); in = driver.open(FSTestCase_class); assertNotNull(in); assertTrue(in.hasNext()); bytes = Utils.readAsBytes(in.next()); assertFalse(in.hasNext()); }
public Resource(String name, URL url) throws IOException { URLConnection conn = url.openConnection(); this.name = name; this.timestamp = conn.getLastModified(); this.content = Utils.readAsBytes(conn.getInputStream()); }
byte[] bytes = Utils.readAsBytes(in); assertTrue(bytes.length > 0);
public Resource(String name, URL url) throws IOException { URLConnection conn = url.openConnection(); this.name = name; this.timestamp = conn.getLastModified(); this.content = Utils.readAsBytes(conn.getInputStream()); }
Iterator<Resource> getResources() throws IOException { Iterator<InputStream> i = driver.open(handle); if (i.hasNext()) { LinkedList<Resource> resources = new LinkedList<Resource>(); while (i.hasNext()) { InputStream in = i.next(); byte[] bytes = Utils.readAsBytes(in); long lastModified = getLastModified(); resources.add(new Resource(name, bytes, lastModified)); } return resources.iterator(); } else { return Utils.iterator(); } }
Iterator<Resource> getResources() throws IOException { Iterator<InputStream> i = driver.open(handle); if (i.hasNext()) { LinkedList<Resource> resources = new LinkedList<Resource>(); while (i.hasNext()) { InputStream in = i.next(); byte[] bytes = Utils.readAsBytes(in); long lastModified = getLastModified(); resources.add(new Resource(name, bytes, lastModified)); } return resources.iterator(); } else { return Utils.iterator(); } }
Resource getResource() throws IOException { InputStream in = open(); byte[] bytes = Utils.readAsBytes(in); long lastModified = getLastModified(); return new Resource(name, bytes, lastModified); }
Resource getResource() throws IOException { InputStream in = open(); byte[] bytes = Utils.readAsBytes(in); long lastModified = getLastModified(); return new Resource(name, bytes, lastModified); }