systemurlconnection.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 47 行
JAVA
47 行
/*
* $Id: SystemURLConnection.java,v 1.1 2003/11/25 11:42:36 epr Exp $
*/
package org.jnode.protocol.system;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import org.jnode.vm.VmSystem;
/**
* @author epr
*/
public class SystemURLConnection extends URLConnection {
private final String path;
/**
* @param url
*/
public SystemURLConnection(URL url) {
super(url);
this.path = url.getPath();
}
/**
* @see java.net.URLConnection#connect()
*/
public void connect() throws IOException {
/* Do nothing */
}
/**
* @see java.net.URLConnection#getInputStream()
*/
public InputStream getInputStream() throws IOException {
InputStream is = VmSystem.getSystemClassLoader().getResourceAsStream(path);
if (is == null) {
throw new IOException("Unknown system resource " + path);
} else {
return is;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?