本文整理汇总了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;
}
示例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;
}
示例3: getPath
import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@NotNull
@Override
public String getPath() {
if (decodedPath == null) {
decodedPath = URLUtil.unescapePercentSequences(path);
}
return decodedPath;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例11: getPath
import com.intellij.util.io.URLUtil; //导入方法依赖的package包/类
@Nonnull
@Override
public String getPath() {
if (decodedPath == null) {
decodedPath = URLUtil.unescapePercentSequences(path);
}
return decodedPath;
}
示例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;
}
示例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);
}
示例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);
}