private static URI fixChecked(final URI uri) { final String ssp = uri.getSchemeSpecificPart(); final String a = uri.getAuthority(); if (null == ssp // URI bug: null == new URI("foo").resolve(new URI("..")).getRawSchemeSpecificPart() || null == a && ssp.startsWith(SEPARATOR + SEPARATOR)) // empty authority return new UriBuilder(uri).toUri(); return uri; }
/** * Initialize this file object by scanning its path for archive * files, using the given {@code ancestor} file (i.e. a direct or * indirect parent file) if any. * {@code file} and {@code detector} must already be initialized! * Must not be called to re-initialize this object! */ private void scan(final @CheckForNull TFile ancestor) { final String path = super.getPath(); assert ancestor == null || path.startsWith(ancestor.getPath()); assert file.getPath().equals(path); assert null != detector; final StringBuilder enclEntryNameBuf = new StringBuilder(path.length()); scan(ancestor, detector, 0, path, enclEntryNameBuf, new Splitter(separatorChar, false)); try { enclEntryName = 0 >= enclEntryNameBuf.length() ? null : new FsEntryName( new UriBuilder().path(enclEntryNameBuf.toString()).getUri(), CANONICALIZE); } catch (URISyntaxException ex) { throw new AssertionError(ex); } }
try { this.enclEntryName = new FsEntryName( new UriBuilder() .path( path.substring(iapl + 1) // cut off leading separatorChar
@edu.umd.cs.findbugs.annotations.SuppressWarnings("ES_COMPARING_STRINGS_WITH_EQ") private static URI name(URI uri) { try { uri = checkFix(uri); final int pl = pathPrefixLength(uri); final String q = uri.getPath(); final String p = cutTrailingSeparators(q, pl); if (p != q) // mind contract of cutTrailingSeparators(String, int) return new UriBuilder(uri).path(p).getUri(); return uri; } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } }
@Before public void setUp() { builder = new UriBuilder(); }
p = cutTrailingSeparators(p, l); try { final UriBuilder ub = new UriBuilder(); if (0 < l) { if (SEPARATOR_CHAR != p.charAt(l - 1))
while ((mp = member.getPath()).startsWith(DOT_DOT_SEPARATOR)) { parent = parent(parent); member = new UriBuilder(member) .path(mp.substring(3)) .getUri(); : pu.getPath() + mp.substring(0, mpl); this.root = new FsPath( new UriBuilder() .scheme(pu.getScheme()) .authority(ma)
private TPath resolve(final URI m) { URI n; final String np; if (TPathScanner.isAbsolute(m) || (n = getName()).toString().isEmpty()) { n = m; } else if (m.toString().isEmpty()) { n = getName(); } else if ((np = n.getPath()).endsWith(SEPARATOR)) { n = n.resolve(m); } else { try { n = new UriBuilder(n).path(np + SEPARATOR_CHAR).getUri().resolve(m); } catch (URISyntaxException ex) { throw new AssertionError(ex); } } final TArchiveDetector d = getDefaultArchiveDetector(); final FsPath p = new TPathScanner(d).scan( TPathScanner.isAbsolute(m) ? TFileSystemProvider.get(getName()).getRoot() : getAddress(), m); return new TPath(n, d, p); }
@Override public URI toUri() { URI n = getName(); String s = n.getScheme(); return new UriBuilder(getAddress().toHierarchicalUri()) .scheme(null != s ? s : TFileSystemProvider.get(n).getScheme()) .toUri(); }
final String pup = ppu.getPath(); if (!pup.endsWith(SEPARATOR)) ppu = new UriBuilder(ppu).path(pup + SEPARATOR_CHAR).getUri(); mp = new FsPath(new FsMountPoint(ppu), men);
continue; final FsEntryName entryName = new FsEntryName( new UriBuilder().path(cen).getUri()); assertEquals(cen, entryName.getPath()); assertEquals(cen, fileSystem.getEntry(entryName).getName());