当前位置: 首页>>代码示例>>Java>>正文


Java URLUtil.unescapePercentSequences方法代码示例

本文整理汇总了Java中com.intellij.util.io.URLUtil.unescapePercentSequences方法的典型用法代码示例。如果您正苦于以下问题:Java URLUtil.unescapePercentSequences方法的具体用法?Java URLUtil.unescapePercentSequences怎么用?Java URLUtil.unescapePercentSequences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.io.URLUtil的用法示例。


在下文中一共展示了URLUtil.unescapePercentSequences方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertFromUrl

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@NotNull
public static String convertFromUrl(@NotNull URL url) {
  String protocol = url.getProtocol();
  String path = url.getPath();
  if (protocol.equals(URLUtil.JAR_PROTOCOL)) {
    if (StringUtil.startsWithConcatenation(path, URLUtil.FILE_PROTOCOL, PROTOCOL_DELIMITER)) {
      try {
        URL subURL = new URL(path);
        path = subURL.getPath();
      }
      catch (MalformedURLException e) {
        throw new RuntimeException(VfsBundle.message("url.parse.unhandled.exception"), e);
      }
    }
    else {
      throw new RuntimeException(new IOException(VfsBundle.message("url.parse.error", url.toExternalForm())));
    }
  }
  if (SystemInfo.isWindows || SystemInfo.isOS2) {
    while (!path.isEmpty() && path.charAt(0) == '/') {
      path = path.substring(1, path.length());
    }
  }

  path = URLUtil.unescapePercentSequences(path);
  return protocol + "://" + path;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:VfsUtilCore.java

示例2: getOpenArgs

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@NotNull
public List<String> getOpenArgs(URI uri) {
  final List<String> args = new ArrayList<String>();
  final String query = uri.getQuery();
  String file = null;
  String line = null;
  if (query != null) {
    for (String param : query.split("&")) {
      String[] pair = param.split("=");
      String key = URLUtil.unescapePercentSequences(pair[0]);
      if (pair.length > 1) {
        if ("file".equals(key)) {
          file = URLUtil.unescapePercentSequences(pair[1]);
        } else if ("line".equals(key)) {
          line = URLUtil.unescapePercentSequences(pair[1]);
        }
      }
    }
  }

  if (file != null) {
    if (line != null) {
      args.add(LINE_NUMBER_ARG_NAME);
      args.add(line);
    }
    args.add(file);
  }
  return args;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:CustomProtocolHandler.java

示例3: getPath

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@NotNull
@Override
public String getPath() {
  if (decodedPath == null) {
    decodedPath = URLUtil.unescapePercentSequences(path);
  }
  return decodedPath;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:UrlImpl.java

示例4: extractRoot

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
/**
 * Attempts to extract classpath entry part from passed URL.
 */
@Nullable
private static String extractRoot(URL resourceURL, String resourcePath) {
  if (!(StringUtil.startsWithChar(resourcePath, '/') || StringUtil.startsWithChar(resourcePath, '\\'))) {
    log("precondition failed: " + resourcePath);
    return null;
  }

  String resultPath = null;
  String protocol = resourceURL.getProtocol();
  if (URLUtil.FILE_PROTOCOL.equals(protocol)) {
    String path = resourceURL.getFile();
    String testPath = path.replace('\\', '/');
    String testResourcePath = resourcePath.replace('\\', '/');
    if (StringUtil.endsWithIgnoreCase(testPath, testResourcePath)) {
      resultPath = path.substring(0, path.length() - resourcePath.length());
    }
  }
  else if (URLUtil.JAR_PROTOCOL.equals(protocol)) {
    Pair<String, String> paths = URLUtil.splitJarUrl(resourceURL.getFile());
    if (paths != null) {
      resultPath = paths.first;
    }
  }

  if (resultPath == null) {
    log("cannot extract: " + resourcePath + " from " + resourceURL);
    return null;
  }

  resultPath = StringUtil.trimEnd(resultPath, File.separator);
  resultPath = URLUtil.unescapePercentSequences(resultPath);

  return resultPath;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:PathManager.java

示例5: extractRoot

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@Nullable
private static String extractRoot(URL resourceURL, String resourcePath) {
	if ((!StringUtil.startsWithChar(resourcePath, '/')) && (!StringUtil.startsWithChar(resourcePath, '\\'))) {
		log("precondition failed: " + resourcePath);
		return null;
	}
	String resultPath = null;
	String protocol = resourceURL.getProtocol();
	if ("file".equals(protocol)) {
		String path = resourceURL.getFile();
		String testPath = path.replace('\\', '/');
		String testResourcePath = resourcePath.replace('\\', '/');
		if (StringUtil.endsWithIgnoreCase(testPath, testResourcePath)) {
			resultPath = path.substring(0, path.length() - resourcePath.length());
		}
	} else if ("jar".equals(protocol)) {
		Pair<String, String> paths = URLUtil.splitJarUrl(resourceURL.getFile());
		if (paths != null) {
			resultPath = paths.first;
		}
	} else if ("bundle".equals(protocol)) {
		resultPath = (new File(
				(PathManager.class.getProtectionDomain().getCodeSource().getLocation() + "").replace("file:/", "")))
						.getAbsolutePath().replace('\\', '/');
	} else {
		throw new UnsupportedOperationException(
				"No '" + protocol + "' known! (" + resourceURL + ", " + resourcePath + ")");
	}
	if (resultPath == null) {
		log("cannot extract: " + resourcePath + " from " + resourceURL);
		return null;
	}
	if ((SystemInfo.isWindows) && (resultPath.startsWith("/"))) {
		resultPath = resultPath.substring(1);
	}
	resultPath = StringUtil.trimEnd(resultPath, File.separator);
	resultPath = URLUtil.unescapePercentSequences(resultPath);

	return resultPath;
}
 
开发者ID:xafero,项目名称:dynkt,代码行数:41,代码来源:PathManager.java

示例6: convertFromUrl

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@NotNull
public static String convertFromUrl(@NotNull URL url) {
  String protocol = url.getProtocol();
  String path = url.getPath();
  if (protocol.equals(StandardFileSystems.JAR_PROTOCOL)) {
    if (StringUtil.startsWithConcatenation(path, StandardFileSystems.FILE_PROTOCOL, PROTOCOL_DELIMITER)) {
      try {
        URL subURL = new URL(path);
        path = subURL.getPath();
      }
      catch (MalformedURLException e) {
        throw new RuntimeException(VfsBundle.message("url.parse.unhandled.exception"), e);
      }
    }
    else {
      throw new RuntimeException(new IOException(VfsBundle.message("url.parse.error", url.toExternalForm())));
    }
  }
  if (SystemInfo.isWindows || SystemInfo.isOS2) {
    while (!path.isEmpty() && path.charAt(0) == '/') {
      path = path.substring(1, path.length());
    }
  }

  path = URLUtil.unescapePercentSequences(path);
  return protocol + "://" + path;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:VfsUtilCore.java

示例7: getOpenArgs

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@NotNull
public List<String> getOpenArgs(URI uri) {
  final List<String> args = new ArrayList<String>();
  final String query = uri.getQuery();
  String file = null;
  String line = null;
  if (query != null) {
    for (String param : query.split("&")) {
      String[] pair = param.split("=");
      String key = URLUtil.unescapePercentSequences(pair[0]);
      if (pair.length > 1) {
        if ("file".equals(key)) {
          file = URLUtil.unescapePercentSequences(pair[1]);
        } else if ("line".equals(key)) {
          line = URLUtil.unescapePercentSequences(pair[1]);
        }
      }
    }
  }

  if (file != null) {
    if (line != null) {
      args.add("--line");
      args.add(line);
    }
    args.add(file);
  }
  return args;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:30,代码来源:CustomProtocolHandler.java

示例8: extractRoot

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
/**
 * Attempts to extract classpath entry part from passed URL.
 */
@Nullable
@NonNls
private static String extractRoot(URL resourceURL, String resourcePath) {
  if (!(StringUtil.startsWithChar(resourcePath, '/') || StringUtil.startsWithChar(resourcePath, '\\'))) {
    //noinspection HardCodedStringLiteral,UseOfSystemOutOrSystemErr
    System.err.println("precondition failed: " + resourcePath);
    return null;
  }

  String resultPath = null;
  String protocol = resourceURL.getProtocol();
  if (URLUtil.FILE_PROTOCOL.equals(protocol)) {
    String path = resourceURL.getFile();
    String testPath = path.replace('\\', '/');
    String testResourcePath = resourcePath.replace('\\', '/');
    if (StringUtil.endsWithIgnoreCase(testPath, testResourcePath)) {
      resultPath = path.substring(0, path.length() - resourcePath.length());
    }
  }
  else if (URLUtil.JAR_PROTOCOL.equals(protocol)) {
    Pair<String, String> paths = URLUtil.splitJarUrl(resourceURL.getFile());
    if (paths != null) {
      resultPath = paths.first;
    }
  }

  if (resultPath == null) {
    //noinspection HardCodedStringLiteral,UseOfSystemOutOrSystemErr
    System.err.println("cannot extract: " + resultPath + " from " + resourceURL);
    return null;
  }

  resultPath = StringUtil.trimEnd(resultPath, File.separator);
  resultPath = URLUtil.unescapePercentSequences(resultPath);

  return resultPath;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:41,代码来源:PathManager.java

示例9: convertFromUrl

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@Nonnull
public static String convertFromUrl(@Nonnull URL url) {
  String protocol = url.getProtocol();
  String path = url.getPath();
  if (protocol.equals(URLUtil.JAR_PROTOCOL)) {
    if (StringUtil.startsWithConcatenation(path, URLUtil.FILE_PROTOCOL, PROTOCOL_DELIMITER)) {
      try {
        URL subURL = new URL(path);
        path = subURL.getPath();
      }
      catch (MalformedURLException e) {
        throw new RuntimeException(VfsBundle.message("url.parse.unhandled.exception"), e);
      }
    }
    else {
      throw new RuntimeException(new IOException(VfsBundle.message("url.parse.error", url.toExternalForm())));
    }
  }
  if (SystemInfo.isWindows || SystemInfo.isOS2) {
    while (!path.isEmpty() && path.charAt(0) == '/') {
      path = path.substring(1, path.length());
    }
  }

  path = URLUtil.unescapePercentSequences(path);
  return protocol + "://" + path;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:28,代码来源:VfsUtilCore.java

示例10: getOpenArgs

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@Nonnull
public List<String> getOpenArgs(URI uri) {
  final List<String> args = new ArrayList<String>();
  final String query = uri.getQuery();
  String file = null;
  String line = null;
  if (query != null) {
    for (String param : query.split("&")) {
      String[] pair = param.split("=");
      String key = URLUtil.unescapePercentSequences(pair[0]);
      if (pair.length > 1) {
        if ("file".equals(key)) {
          file = URLUtil.unescapePercentSequences(pair[1]);
        } else if ("line".equals(key)) {
          line = URLUtil.unescapePercentSequences(pair[1]);
        }
      }
    }
  }

  if (file != null) {
    if (line != null) {
      args.add(LINE_NUMBER_ARG_NAME);
      args.add(line);
    }
    args.add(file);
  }
  return args;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:CustomProtocolHandler.java

示例11: getPath

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@Nonnull
@Override
public String getPath() {
  if (decodedPath == null) {
    decodedPath = URLUtil.unescapePercentSequences(path);
  }
  return decodedPath;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:UrlImpl.java

示例12: extractRoot

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
/**
 * Attempts to extract classpath entry part from passed URL.
 */
@Nullable
@NonNls
private static String extractRoot(URL resourceURL, String resourcePath) {
  if (!(StringUtil.startsWithChar(resourcePath, '/') || StringUtil.startsWithChar(resourcePath, '\\'))) {
    //noinspection HardCodedStringLiteral,UseOfSystemOutOrSystemErr
    System.err.println("precondition failed: " + resourcePath);
    return null;
  }

  String resultPath = null;
  String protocol = resourceURL.getProtocol();
  if (URLUtil.FILE_PROTOCOL.equals(protocol)) {
    String path = resourceURL.getFile();
    String testPath = path.replace('\\', '/');
    String testResourcePath = resourcePath.replace('\\', '/');
    if (StringUtil.endsWithIgnoreCase(testPath, testResourcePath)) {
      resultPath = path.substring(0, path.length() - resourcePath.length());
    }
  }
  else if (URLUtil.JAR_PROTOCOL.equals(protocol)) {
    Pair<String, String> paths = URLUtil.splitJarUrl(resourceURL.getFile());
    if (paths != null) {
      resultPath = paths.first;
    }
  }

  if (resultPath == null) {
    //noinspection HardCodedStringLiteral,UseOfSystemOutOrSystemErr
    System.err.println("cannot extract: " + resourcePath + " from " + resourceURL);
    return null;
  }

  resultPath = StringUtil.trimEnd(resultPath, File.separator);
  resultPath = URLUtil.unescapePercentSequences(resultPath);

  return resultPath;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:41,代码来源:PathManager.java

示例13: unquote

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@NotNull
public static String unquote(@NotNull String urlString) {
  urlString = urlString.replace('/', File.separatorChar);
  return URLUtil.unescapePercentSequences(urlString);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:FileUtil.java

示例14: unquote

import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@Nonnull
public static String unquote(@Nonnull String urlString) {
  urlString = urlString.replace('/', File.separatorChar);
  return URLUtil.unescapePercentSequences(urlString);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:FileUtil.java


注:本文中的com.intellij.util.io.URLUtil.unescapePercentSequences方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。