org.eclipse.equinox.internal.frameworkadmin.utils.Utils.getUrl()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(81)

本文整理了Java中org.eclipse.equinox.internal.frameworkadmin.utils.Utils.getUrl()方法的一些代码示例,展示了Utils.getUrl()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getUrl()方法的具体详情如下:
包路径:org.eclipse.equinox.internal.frameworkadmin.utils.Utils
类名称:Utils
方法名:getUrl

Utils.getUrl介绍

暂无

代码示例

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.frameworkadmin

public static URL checkFullUrl(URL url, String urlName) throws IllegalArgumentException {//throws ManipulatorException {
  if (url == null)
    throw new IllegalArgumentException(urlName + " is null"); //$NON-NLS-1$
  if (!url.getProtocol().endsWith("file")) //$NON-NLS-1$
    return url;
  File file = new File(url.getFile());
  if (!file.isAbsolute())
    throw new IllegalArgumentException(urlName + "(" + url + ") does not have absolute path"); //$NON-NLS-1$ //$NON-NLS-2$
  if (file.getAbsolutePath().startsWith(PATH_SEP))
    return url;
  try {
    return getUrl("file", null, PATH_SEP + file.getAbsolutePath()); //$NON-NLS-1$
  } catch (MalformedURLException e) {
    throw new IllegalArgumentException(urlName + "(" + "file:" + PATH_SEP + file.getAbsolutePath() + ") is not fully quallified"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.frameworkadmin

public static URL checkFullUrl(URL url, String urlName) throws IllegalArgumentException {//throws ManipulatorException {
  if (url == null)
    throw new IllegalArgumentException(urlName + " is null"); //$NON-NLS-1$
  if (!url.getProtocol().endsWith("file")) //$NON-NLS-1$
    return url;
  File file = new File(url.getFile());
  if (!file.isAbsolute())
    throw new IllegalArgumentException(urlName + "(" + url + ") does not have absolute path"); //$NON-NLS-1$ //$NON-NLS-2$
  if (file.getAbsolutePath().startsWith(PATH_SEP))
    return url;
  try {
    return getUrl("file", null, PATH_SEP + file.getAbsolutePath()); //$NON-NLS-1$
  } catch (MalformedURLException e) {
    throw new IllegalArgumentException(urlName + "(" + "file:" + PATH_SEP + file.getAbsolutePath() + ") is not fully quallified"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  }
}

代码示例来源:origin: org.eclipse.equinox/frameworkadmin

public static URL checkFullUrl(URL url, String urlName) throws IllegalArgumentException {//throws ManipulatorException {
  if (url == null)
    throw new IllegalArgumentException(urlName + " is null");
  if (!url.getProtocol().endsWith("file")) //$NON-NLS-1$
    return url;
  File file = new File(url.getFile());
  if (!file.isAbsolute())
    throw new IllegalArgumentException(urlName + "(" + url + ") does not have absolute path");
  if (file.getAbsolutePath().startsWith(PATH_SEP))
    return url;
  try {
    return getUrl("file", null, PATH_SEP + file.getAbsolutePath()); //$NON-NLS-1$
  } catch (MalformedURLException e) {
    throw new IllegalArgumentException(urlName + "(" + "file:" + PATH_SEP + file.getAbsolutePath() + ") is not fully quallified");
  }
}

相关文章