@Test public void test_toUri_with_windows_filepath() throws Exception { URI uri = UriUtil.toUri("c:\\Users\\timur\\workspace\\saga"); assertThat(uri.toString(), equalTo("file:/c:/Users/timur/workspace/saga")); }
public static URI toUri(final String s) { URI uri = createURI(s); if (uri.getScheme() != null) { final Matcher matcher = supportedUriSchemeRe.matcher(uri.getScheme()); Preconditions.checkArgument(matcher.find(), "Supported URI schemes are: http, https and file"); return uri; } return new File(s).toURI().normalize(); }
UriUtil { public static URI toUri(final String s) { URI uri = createURI(s); if (uri.getScheme() != null) { final Matcher matcher = supportedUriSchemeRe.matcher(uri.getScheme()); Preconditions.checkArgument(matcher.find(), "Supported URI schemes are: http, https and file"); return uri; } return new File(s).toURI().normalize(); } }
UriUtil { public static URI toUri(final String s) { URI uri = createURI(s); if (uri.getScheme() != null) { final Matcher matcher = supportedUriSchemeRe.matcher(uri.getScheme()); Preconditions.checkArgument(matcher.find(), "Supported URI schemes are: http, https and file"); return uri; } return new File(s).toURI().normalize(); } private  UriUtil(); }
UriUtil { public static URI toUri(final String s) { URI uri = createURI(s); if (uri.getScheme() != null) { final Matcher matcher = supportedUriSchemeRe.matcher(uri.getScheme()); Preconditions.checkArgument(matcher.find(), "Supported URI schemes are: http, https and file"); return uri; } return new File(s).toURI().normalize(); } private  UriUtil(); static URI toUri(final String s); static boolean isFileUri(final URI uri); static Optional<String> getLastSegment(final URI uri); static String getLastSegmentOrHost(final URI uri); static String getParent(final URI uri); static String getPath(final URI uri); }
UriUtil { public static URI toUri(final String s) { URI uri = createURI(s); if (uri.getScheme() != null) { final Matcher matcher = supportedUriSchemeRe.matcher(uri.getScheme()); Preconditions.checkArgument(matcher.find(), "Supported URI schemes are: http, https and file"); return uri; } return new File(s).toURI().normalize(); } private  UriUtil(); static URI toUri(final String s); static boolean isFileUri(final URI uri); static Optional<String> getLastSegment(final URI uri); static String getLastSegmentOrHost(final URI uri); static String getParent(final URI uri); static String getPath(final URI uri);  }