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


Java URISyntaxException.toString方法代碼示例

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


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

示例1: expandArgument

import java.net.URISyntaxException; //導入方法依賴的package包/類
@Override
protected List<PathData> expandArgument(String arg) throws IOException {
  List<PathData> items = new LinkedList<PathData>();
  if (arg.equals("-")) {
    readStdin = true;
  } else {
    try {
      items.add(new PathData(new URI(arg), getConf()));
    } catch (URISyntaxException e) {
      if (Path.WINDOWS) {
        // Unlike URI, PathData knows how to parse Windows drive-letter paths.
        items.add(new PathData(arg, getConf()));
      } else {
        throw new IOException("Unexpected URISyntaxException: " + e.toString());
      }
    }
  }
  return items;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:20,代碼來源:CopyCommands.java

示例2: doGetResource

import java.net.URISyntaxException; //導入方法依賴的package包/類
@Override
protected URL doGetResource(String name) throws IOException  {
    byte[] buf = archive.getData(this, name);
    if (buf == null) return null;
    if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.log(Level.FINER, "Loading {0} from {1}", new Object[] {name, file.getPath()});
    }
    try {
        return new URL(null, resPrefix + new URI(null, name, null).getRawPath(), new JarURLStreamHandler(jcl));
    } catch (URISyntaxException x) {
        throw new IOException(name + " in " + resPrefix + ": " + x.toString(), x);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:JarClassLoader.java

示例3: connect

import java.net.URISyntaxException; //導入方法依賴的package包/類
@Override
public void connect() throws IOException {
  try {
    FileSystem fs = FileSystem.get(url.toURI(), conf);
    is = fs.open(new Path(url.getPath()));
  } catch (URISyntaxException e) {
    throw new IOException(e.toString());
  }
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:10,代碼來源:FsUrlConnection.java

示例4: toURI

import java.net.URISyntaxException; //導入方法依賴的package包/類
/**
 * Create a URI off the scheme
 * @param path path of URI
 * @return a URI
 * @throws IOException if the URI could not be created
 */
protected URI toURI(String path) throws IOException {
  try {
    return new URI(getScheme(),path, null);
  } catch (URISyntaxException e) {
    throw new IOException(e.toString() + " with " + path, e);
  }
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:14,代碼來源:AbstractFSContract.java

示例5: getBaseURI

import java.net.URISyntaxException; //導入方法依賴的package包/類
public URI getBaseURI(){
try{
    File file = new File(getClass().getClassLoader().getResource(getClass().getName().replaceAll("\\.", "/") + ".class").toURI());
    return file.getParentFile().getParentFile().getParentFile().toURI();
} catch (URISyntaxException e){
    throw new InternalError(e.toString());
}
   }
 
開發者ID:wwu-pi,項目名稱:tap17-muggl-javaee,代碼行數:9,代碼來源:ConfigReader.java

示例6: absolutizeResource

import java.net.URISyntaxException; //導入方法依賴的package包/類
/**
 * Allows a processor to accept relative resource paths.
 * For example, to produce the output value {@code net/nowhere/lib/icon.png}
 * given an element in the package {@code net.nowhere.app}, the following inputs are permitted:
 * <ul>
 * <li>{@code ../lib/icon.png}
 * <li>{@code /net/nowhere/lib/icon.png}
 * </ul>
 * @param originatingElement the annotated element, used for its package
 * @param resource a possibly relative resource path
 * @return an absolute resource path (with no leading slash)
 * @throws LayerGenerationException in case the resource path is malformed
 * @since 7.51
 */
public static String absolutizeResource(Element originatingElement, String resource) throws LayerGenerationException {
    if (resource.startsWith("/")) {
        return resource.substring(1);
    } else {
        try {
            return new URI(null, findPackage(originatingElement).replace('.', '/') + "/", null).resolve(new URI(null, resource, null)).getPath();
        } catch (URISyntaxException x) {
            throw new LayerGenerationException(x.toString(), originatingElement);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:LayerBuilder.java


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