本文整理匯總了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;
}
示例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);
}
}
示例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());
}
}
示例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);
}
}
示例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());
}
}
示例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);
}
}
}