本文整理汇总了Java中com.intellij.util.io.URLUtil.SCHEME_SEPARATOR属性的典型用法代码示例。如果您正苦于以下问题:Java URLUtil.SCHEME_SEPARATOR属性的具体用法?Java URLUtil.SCHEME_SEPARATOR怎么用?Java URLUtil.SCHEME_SEPARATOR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.util.io.URLUtil
的用法示例。
在下文中一共展示了URLUtil.SCHEME_SEPARATOR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toUri
/**
* @return correct URL, must be used only for external communication
*/
@NotNull
public static URI toUri(@NotNull VirtualFile file) {
String path = file.getPath();
try {
String protocol = file.getFileSystem().getProtocol();
if (file.isInLocalFileSystem()) {
if (SystemInfo.isWindows && path.charAt(0) != '/') {
path = '/' + path;
}
return new URI(protocol, "", path, null, null);
}
if (URLUtil.HTTP_PROTOCOL.equals(protocol)) {
return new URI(URLUtil.HTTP_PROTOCOL + URLUtil.SCHEME_SEPARATOR + path);
}
return new URI(protocol, path, null);
}
catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
示例2: testLocationUrl
@Override
public String testLocationUrl(
@Nullable Kind kind, String parentSuite, String name, @Nullable String className) {
// ignore initial value of className -- it's the test runner class.
name = StringUtil.trimTrailing(name, '-');
if (!name.contains("-")) {
return SmRunnerUtils.GENERIC_SUITE_PROTOCOL + URLUtil.SCHEME_SEPARATOR + name;
}
int ix = name.lastIndexOf('-');
className = name.substring(0, ix);
String methodName = name.substring(ix + 1);
return SmRunnerUtils.GENERIC_SUITE_PROTOCOL
+ URLUtil.SCHEME_SEPARATOR
+ className
+ SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
+ methodName;
}
示例3: getSpecs2TestUrl
@Nullable
private static String getSpecs2TestUrl(ScClass testClass, ScInfixExpr testCase) {
String name = null;
String protocol = null;
if (TestNodeProvider.isSpecs2ScopeExpr(testCase)) {
protocol = SmRunnerUtils.GENERIC_SUITE_PROTOCOL;
name = Specs2Utils.getSpecs2ScopeName(testCase);
} else if (TestNodeProvider.isSpecs2Expr(testCase)) {
protocol = SmRunnerUtils.GENERIC_TEST_PROTOCOL;
name = Specs2Utils.getSpecs2ScopedTestName(testCase);
}
if (name == null) {
return null;
}
return protocol
+ URLUtil.SCHEME_SEPARATOR
+ testClass.getQualifiedName()
+ SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
+ name;
}
示例4: toUri
/**
* @return correct URL, must be used only for external communication
*/
@Nonnull
public static URI toUri(@Nonnull VirtualFile file) {
String path = file.getPath();
try {
String protocol = file.getFileSystem().getProtocol();
if (file.isInLocalFileSystem()) {
if (SystemInfo.isWindows && path.charAt(0) != '/') {
path = '/' + path;
}
return new URI(protocol, "", path, null, null);
}
if (URLUtil.HTTP_PROTOCOL.equals(protocol)) {
return new URI(URLUtil.HTTP_PROTOCOL + URLUtil.SCHEME_SEPARATOR + path);
}
return new URI(protocol, path, null);
}
catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
示例5: toIdeaUrl
@NotNull
public static String toIdeaUrl(@NotNull String url, boolean removeLocalhostPrefix) {
int index = url.indexOf(":/");
if (index < 0 || (index + 2) >= url.length()) {
return url;
}
if (url.charAt(index + 2) != '/') {
String prefix = url.substring(0, index);
String suffix = url.substring(index + 2);
if (SystemInfoRt.isWindows) {
return prefix + URLUtil.SCHEME_SEPARATOR + suffix;
}
else if (removeLocalhostPrefix && prefix.equals(URLUtil.FILE_PROTOCOL) && suffix.startsWith(LOCALHOST_URI_PATH_PREFIX)) {
// sometimes (e.g. in Google Chrome for Mac) local file url is prefixed with 'localhost' so we need to remove it
return prefix + ":///" + suffix.substring(LOCALHOST_URI_PATH_PREFIX.length());
}
else {
return prefix + ":///" + suffix;
}
}
else if (SystemInfoRt.isWindows && (index + 3) < url.length() && url.charAt(index + 3) == '/' && url.regionMatches(0, StandardFileSystems.FILE_PROTOCOL_PREFIX, 0, StandardFileSystems.FILE_PROTOCOL_PREFIX.length())) {
// file:///C:/test/file.js -> file://C:/test/file.js
for (int i = index + 4; i < url.length(); i++) {
char c = url.charAt(i);
if (c == '/') {
break;
}
else if (c == ':') {
return StandardFileSystems.FILE_PROTOCOL_PREFIX + url.substring(index + 4);
}
}
return url;
}
return url;
}
示例6: makeKey
/**
* Makes the password database key for the URL: inserts the login after the scheme: http://[email protected]
*/
@NotNull
private static String makeKey(@NotNull String url, @Nullable String login) {
if (login == null) {
return url;
}
Couple<String> pair = UriUtil.splitScheme(url);
String scheme = pair.getFirst();
if (!StringUtil.isEmpty(scheme)) {
return scheme + URLUtil.SCHEME_SEPARATOR + login + "@" + pair.getSecond();
}
return login + "@" + url;
}
示例7: pathToUrl
@NotNull
private static String pathToUrl(@NotNull String filePath) {
filePath = FileUtil.toSystemIndependentName(filePath);
if (filePath.endsWith(".srcjar") || filePath.endsWith(".jar")) {
return URLUtil.JAR_PROTOCOL + URLUtil.SCHEME_SEPARATOR + filePath + URLUtil.JAR_SEPARATOR;
} else if (filePath.contains("src.jar!")) {
return URLUtil.JAR_PROTOCOL + URLUtil.SCHEME_SEPARATOR + filePath;
} else {
return VfsUtilCore.pathToUrl(filePath);
}
}
示例8: pathToUrl
public static String pathToUrl(String filePath) {
filePath = FileUtil.toSystemIndependentName(filePath);
if (filePath.endsWith(".srcjar") || filePath.endsWith(".jar")) {
return URLUtil.JAR_PROTOCOL + URLUtil.SCHEME_SEPARATOR + filePath + URLUtil.JAR_SEPARATOR;
} else if (filePath.contains("src.jar!")) {
return URLUtil.JAR_PROTOCOL + URLUtil.SCHEME_SEPARATOR + filePath;
} else {
return VirtualFileManager.constructUrl(
VirtualFileSystemProvider.getInstance().getSystem().getProtocol(), filePath);
}
}
示例9: testLocationUrl
/** Converts the test case and suite names to a parsable location URL. */
default String testLocationUrl(
@Nullable Kind kind, String parentSuite, String name, @Nullable String className) {
String base = SmRunnerUtils.GENERIC_TEST_PROTOCOL + URLUtil.SCHEME_SEPARATOR;
if (Strings.isNullOrEmpty(className)) {
return base + name;
}
return base + className + SmRunnerUtils.TEST_NAME_PARTS_SPLITTER + name;
}
示例10: testLocationUrl
@Override
public String testLocationUrl(
@Nullable Kind kind, String parentSuite, String name, @Nullable String classname) {
if (classname == null) {
return null;
}
String classComponent = JavaTestLocator.TEST_PROTOCOL + URLUtil.SCHEME_SEPARATOR + classname;
String parameterComponent = extractParameterComponent(name);
if (parameterComponent != null) {
return classComponent + "." + parentSuite + parameterComponent;
}
return classComponent + "." + name;
}
示例11: getTestClassUrl
@Nullable
private static String getTestClassUrl(TestFramework framework, ScClass testClass) {
if (!framework.isTestClass(testClass)) {
return null;
}
return SmRunnerUtils.GENERIC_SUITE_PROTOCOL
+ URLUtil.SCHEME_SEPARATOR
+ testClass.getQualifiedName();
}
示例12: getTestMethodUrl
@Nullable
private static String getTestMethodUrl(
TestFramework framework, ScClass testClass, ScFunctionDefinition method) {
if (!framework.isTestMethod(method)) {
return null;
}
return SmRunnerUtils.GENERIC_TEST_PROTOCOL
+ URLUtil.SCHEME_SEPARATOR
+ testClass.getQualifiedName()
+ SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
+ method.getName();
}
示例13: testLocationUrl
@Override
public String testLocationUrl(
@Nullable Kind kind, String parentSuite, String name, @Nullable String className) {
return SmRunnerUtils.GENERIC_TEST_PROTOCOL
+ URLUtil.SCHEME_SEPARATOR
+ parentSuite
+ SmRunnerUtils.TEST_NAME_PARTS_SPLITTER
+ name;
}
示例14: getHost
@NotNull
private static String getHost(@NotNull String url) {
Pair<String, String> split = URLUtil.splitScheme(url);
String scheme = split.getFirst();
String urlItself = split.getSecond();
int pathStart = urlItself.indexOf("/");
return scheme + URLUtil.SCHEME_SEPARATOR + urlItself.substring(0, pathStart);
}
示例15: makeKey
/**
* Makes the password database key for the URL: inserts the login after the scheme: http://[email protected]
*/
@NotNull
private static String makeKey(@NotNull String url, @NotNull String login) {
Pair<String,String> pair = URLUtil.splitScheme(url);
String scheme = pair.getFirst();
if (StringUtil.isEmpty(scheme)) {
return scheme + URLUtil.SCHEME_SEPARATOR + login + "@" + pair.getSecond();
}
return login + "@" + url;
}