先调用 java.net.URL.toURI() 转成 URI
再获取 java.net.URI.getScheme()
示例:
public static void main(String[] args) throws MalformedURLException,URISyntaxException{
URL url = new URL("https://github.com/venusdrogon/feilong-core");
URI uri = url.toURI();
System.out.println(uri.getScheme());
}
结果:
https