當前位置: 首頁>>代碼示例>>Java>>正文


Java URI.getRawSchemeSpecificPart方法代碼示例

本文整理匯總了Java中java.net.URI.getRawSchemeSpecificPart方法的典型用法代碼示例。如果您正苦於以下問題:Java URI.getRawSchemeSpecificPart方法的具體用法?Java URI.getRawSchemeSpecificPart怎麽用?Java URI.getRawSchemeSpecificPart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.net.URI的用法示例。


在下文中一共展示了URI.getRawSchemeSpecificPart方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFileName

import java.net.URI; //導入方法依賴的package包/類
/**
 * Returns the file name of the resource references by the URI. Works with jar: URIs, which normally return
 * {@code null} if the {@link URI#getPath()} call is used.
 * @param uri
 * @return The filename, if it can be calculated.
 * @throws IllegalArgumentException if the filename cannot be calculated (e.g. if the scheme is not understood).
 */
public static String getFileName(URI uri) throws IllegalArgumentException {
	String filename;
	if (JAR_URI_SCHEME.equals(uri.getScheme())) {
		String ssp = uri.getRawSchemeSpecificPart();
		String innerPath;
		int bang = ssp.indexOf('!');
		if (bang < 0) {
               throw new IllegalArgumentException("Invalid jar content URI; missing '!/' path separator: " + uri);
           } else {
               innerPath = ssp.substring(bang + 1);
           }
		filename = getPathLastSegment(innerPath);
	} else {
		String path = uri.getPath();
		if (path == null) {
               throw new IllegalArgumentException("Cannot calculate filename for unknown opaque URI scheme: " + uri);
           }
		filename = getPathLastSegment(path);
	}
	return filename;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:29,代碼來源:URIUtils.java

示例2: uriToPath

import java.net.URI; //導入方法依賴的package包/類
protected Path uriToPath(URI uri) {
    String scheme = uri.getScheme();
    if ((scheme == null) || !scheme.equalsIgnoreCase(getScheme())) {
        throw new IllegalArgumentException("URI scheme is not '" + getScheme() + "'");
    }
    try {
        // only support legacy JAR URL syntax  jar:{uri}!/{entry} for now
        String spec = uri.getRawSchemeSpecificPart();
        int sep = spec.indexOf("!/");
        if (sep != -1)
            spec = spec.substring(0, sep);
        return Paths.get(new URI(spec)).toAbsolutePath();
    } catch (URISyntaxException e) {
        throw new IllegalArgumentException(e.getMessage(), e);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:ZipFileSystemProvider.java

示例3: uriToPath

import java.net.URI; //導入方法依賴的package包/類
protected Path uriToPath(URI uri) {
    String scheme = uri.getScheme();
    if ((scheme == null) || !scheme.equalsIgnoreCase(getScheme())) {
        throw new IllegalArgumentException("URI scheme is not '" + getScheme() + "'");
    }
    try {
        // only support legacy JAR URL syntax  jar:{uri}!/{entry} for now
        String spec = uri.getRawSchemeSpecificPart();
        int sep = spec.indexOf("!/");
        if (sep != -1) {
            spec = spec.substring(0, sep);
        }
        return Paths.get(new URI(spec)).toAbsolutePath();
    } catch (URISyntaxException e) {
        throw new IllegalArgumentException(e.getMessage(), e);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:ZipFileSystemProvider.java

示例4: digestURI

import java.net.URI; //導入方法依賴的package包/類
private void digestURI(final URI uri) {
    this.scheme = uri.getScheme();
    this.encodedSchemeSpecificPart = uri.getRawSchemeSpecificPart();
    this.encodedAuthority = uri.getRawAuthority();
    this.host = uri.getHost();
    this.port = uri.getPort();
    this.encodedUserInfo = uri.getRawUserInfo();
    this.userInfo = uri.getUserInfo();
    this.encodedPath = uri.getRawPath();
    this.path = uri.getPath();
    this.encodedQuery = uri.getRawQuery();
    this.queryParams = parseQuery(uri.getRawQuery(), Charset.forName(HTTP.UTF_8));
    this.encodedFragment = uri.getRawFragment();
    this.fragment = uri.getFragment();
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:16,代碼來源:URIBuilder.java

示例5: digestURI

import java.net.URI; //導入方法依賴的package包/類
private void digestURI(final URI uri) {
    this.scheme = uri.getScheme();
    this.encodedSchemeSpecificPart = uri.getRawSchemeSpecificPart();
    this.encodedAuthority = uri.getRawAuthority();
    this.host = uri.getHost();
    this.port = uri.getPort();
    this.encodedUserInfo = uri.getRawUserInfo();
    this.userInfo = uri.getUserInfo();
    this.encodedPath = uri.getRawPath();
    this.path = uri.getPath();
    this.encodedQuery = uri.getRawQuery();
    this.queryParams = parseQuery(uri.getRawQuery(), Consts.UTF_8);
    this.encodedFragment = uri.getRawFragment();
    this.fragment = uri.getFragment();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:URIBuilder.java


注:本文中的java.net.URI.getRawSchemeSpecificPart方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。