@Test public void getFile() { assertEquals("/", GfsUriUtils.getFile(URI.create("gfs:/repo#/"))); assertEquals("/", GfsUriUtils.getFile(URI.create("gfs:/repo#"))); assertEquals("/a.txt", GfsUriUtils.getFile(URI.create("gfs:/repo#/a.txt"))); assertEquals("/a/b.txt", GfsUriUtils.getFile(URI.create("gfs:/repo#/a/b.txt"))); assertEquals("/a/b.txt", GfsUriUtils.getFile(URI.create("gfs:/repo#a/b.txt"))); assertEquals("/a/b", GfsUriUtils.getFile(URI.create("gfs:/repo#a/b"))); assertEquals("/a/b", GfsUriUtils.getFile(URI.create("gfs:/repo#/a/b/"))); }
@Nonnull public static String getFile(URI uri) throws ProviderMismatchException { checkScheme(uri); String fragment = uri.getFragment(); if(fragment == null) fragment = ""; if(!fragment.startsWith("/")) fragment = "/" + fragment; if(fragment.length() > 1 && fragment.endsWith("/")) fragment = fragment.substring(0, fragment.length() - 1); return fragment; }
GfsUriUtils { @Nonnull public static String getFile(URI uri) throws ProviderMismatchException { checkScheme(uri); String fragment = uri.getFragment(); if(fragment == null) fragment = ""; if(!fragment.startsWith("/")) fragment = "/" + fragment; if(fragment.length() > 1 && fragment.endsWith("/")) fragment = fragment.substring(0, fragment.length() - 1); return fragment; } }
GfsUriUtils { @Nonnull public static String getFile(URI uri) throws ProviderMismatchException { checkScheme(uri); String fragment = uri.getFragment(); if(fragment == null) fragment = ""; if(!fragment.startsWith("/")) fragment = "/" + fragment; if(fragment.length() > 1 && fragment.endsWith("/")) fragment = fragment.substring(0, fragment.length() - 1); return fragment; }  }
GfsUriUtils { @Nonnull public static String getFile(URI uri) throws ProviderMismatchException { checkScheme(uri); String fragment = uri.getFragment(); if(fragment == null) fragment = ""; if(!fragment.startsWith("/")) fragment = "/" + fragment; if(fragment.length() > 1 && fragment.endsWith("/")) fragment = fragment.substring(0, fragment.length() - 1); return fragment; }  @Nonnull static String getRepository(URI uri); @Nonnull static String getFile(URI uri); @Nonnull static Map<String, String> parseQuery(@Nullable String query, @Nullable Set<String> keys); @Nullable static String getSession(URI uri); }
GfsUriUtils { @Nonnull public static String getFile(URI uri) throws ProviderMismatchException { checkScheme(uri); String fragment = uri.getFragment(); if(fragment == null) fragment = ""; if(!fragment.startsWith("/")) fragment = "/" + fragment; if(fragment.length() > 1 && fragment.endsWith("/")) fragment = fragment.substring(0, fragment.length() - 1); return fragment; }  @Nonnull static String getRepository(URI uri); @Nonnull static String getFile(URI uri); @Nonnull static Map<String, String> parseQuery(@Nullable String query, @Nullable Set<String> keys); @Nullable static String getSession(URI uri); final static String SID_KEY; }