@Override public Mount<Path> create(Path path) throws IOException { // Not a great implementation return new Mount<Path>(new RAMDriver(), null); } }
public void add(String path, String file) { add(Path.get(path), file); }
public RAMDriver() { try { this.root = Path.get("/"); this.entries = new HashMap<Path, String>(); this.baseURL = new URL("ram", null, 0, "/", new RAMURLStreamHandler(this)); } catch (MalformedURLException e) { throw new UndeclaredThrowableException(e); } }
public void testRAM() throws Exception { RAMDriver driver = new RAMDriver(); driver.add("/foo", "bar"); Path root = driver.root(); assertEquals(Path.get("/"), root); Path foo = driver.child(root, "foo"); assertNotNull(foo); Iterator<InputStream> in = driver.open(foo); assertTrue(in.hasNext()); String file = Utils.readAsUTF8(in.next()); assertFalse(in.hasNext()); assertEquals("bar", file); }
@Override protected URLConnection openConnection(URL u) throws IOException { Path path = Path.get(u.getFile()); if (path.isDir()) { throw new IOException("Cannot open dir"); } String file = driver.entries.get(path); if (file == null) { throw new IOException("Cannot open non existing dir " + path); } return new RAMURLConnection(u, file); } }
public void testMount() throws Exception { RAMMountFactory resolver = new RAMMountFactory(); FS fs = new FS.Builder().register("ram", resolver).mount("ram:/;ram:/b").build(); assertEquals(2, fs.drivers.size()); assertInstance(RAMDriver.class, fs.drivers.get(0)); assertInstance(RAMDriver.class, fs.drivers.get(1)); } }
public void bind(String name, String ext, String command) { if (name.contains("/")) { throw new IllegalArgumentException("Command name must not contain /"); } if (name.contains(".")) { throw new IllegalArgumentException("Command name must not contain ."); } commands.add(Path.get("/" + name + "." + ext), command); context.refresh(); }
@Override public Mount<Path> create(Path path) throws IOException { // Not a great implementation return new Mount<Path>(new RAMDriver(), null); } }
public RAMDriver() { try { this.root = Path.get("/"); this.entries = new HashMap<Path, String>(); this.baseURL = new URL("ram", null, 0, "/", new RAMURLStreamHandler(this)); } catch (MalformedURLException e) { throw new UndeclaredThrowableException(e); } }
@Override protected URLConnection openConnection(URL u) throws IOException { Path path = Path.get(u.getFile()); if (path.isDir()) { throw new IOException("Cannot open dir"); } String file = driver.entries.get(path); if (file == null) { throw new IOException("Cannot open non existing dir " + path); } return new RAMURLConnection(u, file); } }
public void add(String path, String file) { add(Path.get(path), file); }
@Override public Mount<Path> create(Path path) throws IOException { // Not a great implementation return new Mount<Path>(new RAMDriver(), null); } }
public RAMDriver() { try { this.root = Path.get("/"); this.entries = new HashMap<Path, String>(); this.baseURL = new URL("ram", null, 0, "/", new RAMURLStreamHandler(this)); } catch (MalformedURLException e) { throw new UndeclaredThrowableException(e); } }
@Override protected URLConnection openConnection(URL u) throws IOException { Path path = Path.get(u.getFile()); if (path.isDir()) { throw new IOException("Cannot open dir"); } String file = driver.entries.get(path); if (file == null) { throw new IOException("Cannot open non existing dir " + path); } return new RAMURLConnection(u, file); } }
public void add(String path, String file) { add(Path.get(path), file); }
private TestPluginLifeCycle(PluginDiscovery discovery, ClassLoader classLoader) throws Exception { this.attributes = new HashMap<String, Object>(); this.commands = new RAMDriver(); this.context = new PluginContext( discovery, attributes, new FS().mount(classLoader,Path.get("/crash/commands/")).mount(commands), new FS().mount(classLoader,Path.get("/crash/")), classLoader); this.crash = new CRaSH(context); }
public RAMDriver() { try { this.root = Path.get("/"); this.entries = new HashMap<Path, String>(); this.baseURL = new URL("ram", null, 0, "/", new RAMURLStreamHandler(this)); } catch (MalformedURLException e) { throw new UndeclaredThrowableException(e); } }
@Override protected URLConnection openConnection(URL u) throws IOException { Path path = Path.get(u.getFile()); if (path.isDir()) { throw new IOException("Cannot open dir"); } String file = driver.entries.get(path); if (file == null) { throw new IOException("Cannot open non existing dir " + path); } return new RAMURLConnection(u, file); } }
public void add(String path, String file) { add(Path.get(path), file); }