Codota Logo
UrlUtils
Code IndexAdd Codota to your IDE (free)

How to use
UrlUtils
in
libcore.net.url

Best Java code snippets using libcore.net.url.UrlUtils (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: robovm/robovm

  fileStart = UrlUtils.findFirstOf(spec, "/?#", authorityStart, end);
  authority = spec.substring(authorityStart, fileStart);
  int userInfoEnd = UrlUtils.findFirstOf(spec, "@", authorityStart, fileStart);
  int hostStart;
  if (userInfoEnd != fileStart) {
  int ipv6End = UrlUtils.findFirstOf(spec, "]", hostStart, fileStart);
  if (ipv6End != fileStart) {
    if (UrlUtils.findFirstOf(spec, ":", hostStart, ipv6End) == ipv6End) {
      throw new IllegalArgumentException("Expected an IPv6 address: "
          + spec.substring(hostStart, ipv6End + 1));
  int hostEnd = UrlUtils.findFirstOf(spec, ":", colonSearchFrom, fileStart);
  host = spec.substring(hostStart, hostEnd);
  int portStart = hostEnd + 1;
    break;
  case '?':
    nextPos = UrlUtils.findFirstOf(spec, "#", pos, end);
    query = spec.substring(pos + 1, nextPos);
    ref = null;
    break;
  default:
    nextPos = UrlUtils.findFirstOf(spec, "?#", pos, end);
    path = relativePath(path, spec.substring(pos, nextPos));
    query = null;
path = UrlUtils.authoritySafePath(authority, path);
origin: robovm/robovm

/**
 * Returns a new path by resolving {@code path} relative to {@code base}.
 */
private static String relativePath(String base, String path) {
  if (path.startsWith("/")) {
    return UrlUtils.canonicalizePath(path, true);
  } else if (base != null) {
    String combined = base.substring(0, base.lastIndexOf('/') + 1) + path;
    return UrlUtils.canonicalizePath(combined, true);
  } else {
    return path;
  }
}
origin: robovm/robovm

protocol = UrlUtils.getSchemePrefix(spec);
int schemeSpecificPartStart = protocol != null ? (protocol.length() + 1) : 0;
origin: robovm/robovm

private String validateScheme(String uri, int end) throws URISyntaxException {
  if (end == 0) {
    throw new URISyntaxException(uri, "Scheme expected", 0);
  }
  for (int i = 0; i < end; i++) {
    if (!UrlUtils.isValidSchemeChar(i, uri.charAt(i))) {
      throw new URISyntaxException(uri, "Illegal character in scheme", 0);
    }
  }
  return uri.substring(0, end);
}
origin: robovm/robovm

this.port = port;
file = UrlUtils.authoritySafePath(host, file);
origin: robovm/robovm

int fragmentStart = UrlUtils.findFirstOf(uri, "#", 0, uri.length());
if (fragmentStart < uri.length()) {
  fragment = ALL_LEGAL_ENCODER.validate(uri, fragmentStart + 1, uri.length(), "fragment");
int colon = UrlUtils.findFirstOf(uri, ":", 0, fragmentStart);
if (colon < UrlUtils.findFirstOf(uri, "/?#", 0, fragmentStart)) {
  absolute = true;
  scheme = validateScheme(uri, colon);
if (uri.regionMatches(start, "//", 0, 2)) {
  int authorityStart = start + 2;
  fileStart = UrlUtils.findFirstOf(uri, "/?", authorityStart, fragmentStart);
  if (authorityStart == uri.length()) {
    throw new URISyntaxException(uri, "Authority expected", uri.length());
int queryStart = UrlUtils.findFirstOf(uri, "?", fileStart, fragmentStart);
path = PATH_ENCODER.validate(uri, fileStart, queryStart, "path");
origin: robovm/robovm

/**
 * Returns the scheme prefix like "http" from the URL spec, or null if the
 * spec doesn't start with a scheme. Scheme prefixes match this pattern:
 * {@code alpha ( alpha | digit | '+' | '-' | '.' )* ':'}
 */
public static String getSchemePrefix(String spec) {
  int colon = spec.indexOf(':');
  if (colon < 1) {
    return null;
  }
  for (int i = 0; i < colon; i++) {
    char c = spec.charAt(i);
    if (!isValidSchemeChar(i, c)) {
      return null;
    }
  }
  return spec.substring(0, colon).toLowerCase(Locale.US);
}
origin: robovm/robovm

  resolvedPath = path.substring(0, endIndex) + relative.path;
result.path = UrlUtils.authoritySafePath(result.authority, normalize(resolvedPath, true));
result.setSchemeSpecificPart();
return result;
origin: MobiVM/robovm

int fragmentStart = UrlUtils.findFirstOf(uri, "#", 0, uri.length());
if (fragmentStart < uri.length()) {
  fragment = ALL_LEGAL_ENCODER.validate(uri, fragmentStart + 1, uri.length(), "fragment");
int colon = UrlUtils.findFirstOf(uri, ":", 0, fragmentStart);
if (colon < UrlUtils.findFirstOf(uri, "/?#", 0, fragmentStart)) {
  absolute = true;
  scheme = validateScheme(uri, colon);
if (uri.regionMatches(start, "//", 0, 2)) {
  int authorityStart = start + 2;
  fileStart = UrlUtils.findFirstOf(uri, "/?", authorityStart, fragmentStart);
  if (authorityStart == uri.length()) {
    throw new URISyntaxException(uri, "Authority expected", uri.length());
int queryStart = UrlUtils.findFirstOf(uri, "?", fileStart, fragmentStart);
path = PATH_ENCODER.validate(uri, fileStart, queryStart, "path");
origin: com.gluonhq/robovm-rt

  fileStart = UrlUtils.findFirstOf(spec, "/?#", authorityStart, end);
  authority = spec.substring(authorityStart, fileStart);
  int userInfoEnd = UrlUtils.findFirstOf(spec, "@", authorityStart, fileStart);
  int hostStart;
  if (userInfoEnd != fileStart) {
  int ipv6End = UrlUtils.findFirstOf(spec, "]", hostStart, fileStart);
  if (ipv6End != fileStart) {
    if (UrlUtils.findFirstOf(spec, ":", hostStart, ipv6End) == ipv6End) {
      throw new IllegalArgumentException("Expected an IPv6 address: "
          + spec.substring(hostStart, ipv6End + 1));
  int hostEnd = UrlUtils.findFirstOf(spec, ":", colonSearchFrom, fileStart);
  host = spec.substring(hostStart, hostEnd);
  int portStart = hostEnd + 1;
    break;
  case '?':
    nextPos = UrlUtils.findFirstOf(spec, "#", pos, end);
    query = spec.substring(pos + 1, nextPos);
    ref = null;
    break;
  default:
    nextPos = UrlUtils.findFirstOf(spec, "?#", pos, end);
    path = relativePath(path, spec.substring(pos, nextPos));
    query = null;
path = UrlUtils.authoritySafePath(authority, path);
origin: robovm/robovm

/**
 * Returns the normalized path.
 */
private String normalize(String path, boolean discardRelativePrefix) {
  path = UrlUtils.canonicalizePath(path, discardRelativePrefix);
  /*
   * If the path contains a colon before the first colon, prepend
   * "./" to differentiate the path from a scheme prefix.
   */
  int colon = path.indexOf(':');
  if (colon != -1) {
    int slash = path.indexOf('/');
    if (slash == -1 || colon < slash) {
      path = "./" + path;
    }
  }
  return path;
}
origin: com.gluonhq/robovm-rt

private String validateScheme(String uri, int end) throws URISyntaxException {
  if (end == 0) {
    throw new URISyntaxException(uri, "Scheme expected", 0);
  }
  for (int i = 0; i < end; i++) {
    if (!UrlUtils.isValidSchemeChar(i, uri.charAt(i))) {
      throw new URISyntaxException(uri, "Illegal character in scheme", 0);
    }
  }
  return uri.substring(0, end);
}
origin: MobiVM/robovm

this.port = port;
file = UrlUtils.authoritySafePath(host, file);
origin: com.gluonhq/robovm-rt

protocol = UrlUtils.getSchemePrefix(spec);
int schemeSpecificPartStart = protocol != null ? (protocol.length() + 1) : 0;
origin: ibinti/bugvm

int fragmentStart = UrlUtils.findFirstOf(uri, "#", 0, uri.length());
if (fragmentStart < uri.length()) {
  fragment = ALL_LEGAL_ENCODER.validate(uri, fragmentStart + 1, uri.length(), "fragment");
int colon = UrlUtils.findFirstOf(uri, ":", 0, fragmentStart);
if (colon < UrlUtils.findFirstOf(uri, "/?#", 0, fragmentStart)) {
  absolute = true;
  scheme = validateScheme(uri, colon);
if (uri.regionMatches(start, "//", 0, 2)) {
  int authorityStart = start + 2;
  fileStart = UrlUtils.findFirstOf(uri, "/?", authorityStart, fragmentStart);
  if (authorityStart == uri.length()) {
    throw new URISyntaxException(uri, "Authority expected", uri.length());
int queryStart = UrlUtils.findFirstOf(uri, "?", fileStart, fragmentStart);
path = PATH_ENCODER.validate(uri, fileStart, queryStart, "path");
origin: com.mobidevelop.robovm/robovm-rt

  fileStart = UrlUtils.findFirstOf(spec, "/?#", authorityStart, end);
  authority = spec.substring(authorityStart, fileStart);
  int userInfoEnd = UrlUtils.findFirstOf(spec, "@", authorityStart, fileStart);
  int hostStart;
  if (userInfoEnd != fileStart) {
  int ipv6End = UrlUtils.findFirstOf(spec, "]", hostStart, fileStart);
  if (ipv6End != fileStart) {
    if (UrlUtils.findFirstOf(spec, ":", hostStart, ipv6End) == ipv6End) {
      throw new IllegalArgumentException("Expected an IPv6 address: "
          + spec.substring(hostStart, ipv6End + 1));
  int hostEnd = UrlUtils.findFirstOf(spec, ":", colonSearchFrom, fileStart);
  host = spec.substring(hostStart, hostEnd);
  int portStart = hostEnd + 1;
    break;
  case '?':
    nextPos = UrlUtils.findFirstOf(spec, "#", pos, end);
    query = spec.substring(pos + 1, nextPos);
    ref = null;
    break;
  default:
    nextPos = UrlUtils.findFirstOf(spec, "?#", pos, end);
    path = relativePath(path, spec.substring(pos, nextPos));
    query = null;
path = UrlUtils.authoritySafePath(authority, path);
origin: robovm/robovm

int idx = file.indexOf('!');
String tmpFile = file.substring(idx + 1, file.lastIndexOf('/') + 1) + spec;
tmpFile = UrlUtils.canonicalizePath(tmpFile, true);
file = file.substring(0, idx + 1) + tmpFile;
origin: MobiVM/robovm

private String validateScheme(String uri, int end) throws URISyntaxException {
  if (end == 0) {
    throw new URISyntaxException(uri, "Scheme expected", 0);
  }
  for (int i = 0; i < end; i++) {
    if (!UrlUtils.isValidSchemeChar(i, uri.charAt(i))) {
      throw new URISyntaxException(uri, "Illegal character in scheme", 0);
    }
  }
  return uri.substring(0, end);
}
origin: com.bugvm/bugvm-rt

this.port = port;
file = UrlUtils.authoritySafePath(host, file);
origin: com.mobidevelop.robovm/robovm-rt

protocol = UrlUtils.getSchemePrefix(spec);
int schemeSpecificPartStart = protocol != null ? (protocol.length() + 1) : 0;
libcore.net.urlUrlUtils

Most used methods

  • authoritySafePath
    Returns a path that can be safely concatenated with authority. If the authority is null or empty, th
  • canonicalizePath
    Returns the path will relative path segments like ".." and "." resolved. The returned path will not
  • findFirstOf
    Returns the index of the first char of chars in stringbounded between start and end. This returns en
  • getSchemePrefix
    Returns the scheme prefix like "http" from the URL spec, or null if the spec doesn't start with a sc
  • isValidSchemeChar

Popular in Java

  • Updating database using SQL prepared statement
  • runOnUiThread (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getContentResolver (Context)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • Join (org.hibernate.mapping)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now