assert null != enclEntryName; return new FsPath( new FsMountPoint( scheme, new FsPath( new FsMountPoint(enclArchive.toURI(), CANONICALIZE), enclEntryName)), ROOT); } else { return new FsPath( new FsMountPoint(scheme, new FsPath(file)), ROOT); assert null != enclEntryName; return new FsPath( new FsMountPoint(enclArchive.toURI(), CANONICALIZE), enclEntryName); } else {
if (null != enclArchive) { assert null != enclEntryName; return new FsMountPoint( scheme, new FsPath( new FsMountPoint(enclArchive.toURI(), CANONICALIZE), enclEntryName)).toUri(); } else { return new FsMountPoint(scheme, new FsPath(file)).toUri(); new FsMountPoint(enclArchive.toURI(), CANONICALIZE), enclEntryName).toUri(); } else {
/** * Returns a mount point for the given (virtual) directory {@code tree}. * If {@code tree} refers to a (prospective) archive file, then its mount * point gets returned. * Otherwise, the path of the file object is used to create a new mount * point. * Note that making up an artificial mount point like this will only work * with the {@link FsFilteringManager}! * * @param tree a file or directory in the (virtual) file system space. * @return A mount point for the given (virtual) directory tree. */ static FsMountPoint mountPoint(final TFile tree) { if (tree.isArchive()) { return tree.getController().getModel().getMountPoint(); // fast path //return tree.toFsPath().getMountPoint(); // slow path } try { return new FsMountPoint(new URI(tree.getFile().toURI() + "/"), CANONICALIZE); } catch (final URISyntaxException ex) { throw new AssertionError(ex); } }
@Test public void testMountPoint() throws URISyntaxException { for (final String[] params : new String[][] { // { $file, $mountPoint } { "fö ö.mok/b är", CURRENT_DIRECTORY + "fö%20ö.mok/b%20är/" }, { "fö ö.mok", "mok:" + CURRENT_DIRECTORY + "fö%20ö.mok!/" }, { "fö ö", CURRENT_DIRECTORY + "fö%20ö/" }, { ".", CURRENT_DIRECTORY.toString() }, { "", CURRENT_DIRECTORY.toString() }, }) { final TFile file = new TFile(params[0]); final FsMountPoint mountPoint = new FsMountPoint(new URI(params[1])); assertThat(mountPoint(file), is(mountPoint)); } } }
if (!pup.endsWith(SEPARATOR)) ppu = new UriBuilder(ppu).path(pup + SEPARATOR_CHAR).getUri(); mp = new FsPath(new FsMountPoint(ppu), men); mp = new FsPath(new FsMountPoint(s, mp), ROOT); return mp;
private static void assertScan(final String... params) throws URISyntaxException { final FsPath parent = new FsPath(new URI(params[0])); final URI member = new URI(params[1]); final FsPath path = new FsPath(new URI(params[2])); final FsMountPoint mountPoint = null == params[3] ? null : new FsMountPoint(new URI(params[3])); final FsPath result = new TPathScanner( TConfig.get().getArchiveDetector()) .scan(parent, member); assertThat(result, equalTo(path)); assertThat(result.getMountPoint(), is(mountPoint)); }
final FsEntryName enclEntryName = this.enclEntryName; assert (null != enclArchive) == (null != enclEntryName); mountPoint = new FsMountPoint(scheme, null == enclArchive ? new FsPath( file) : new FsPath( enclArchive .getController()
new FsMountPoint((URI) null); fail(); } catch (NullPointerException expected) { new FsMountPoint((URI) null, NULL); fail(); } catch (NullPointerException expected) { new FsMountPoint((URI) null, CANONICALIZE); fail(); } catch (NullPointerException expected) { new FsMountPoint((FsScheme) null, null); fail(); } catch (NullPointerException expected) { new FsMountPoint(uri); fail(param); } catch (URISyntaxException expected) { final FsPath path = FsPath.create(URI.create(params[1])); try { new FsMountPoint(scheme, path); fail(params[0] + ":" + params[1] + "!/"); } catch (URISyntaxException expected) {