判断远程资源是否可访问
类别: JAVA教程
import java.net.*;
import java.io.*;
public class test
{
public static void main(String[] args){
URL url = null;
URLConnection urlCon;
InputStream inStream;//你只需判断这个变量值 .
try{
url = new URL("http","www13.kaxiu.com",80,"modules/959908432/hua_cs.html");
urlCon = url.openConnection();
inStream = urlCon.getInputStream();
}
catch(MalformedURLException e){}
catch(java.io.IOException e2){}
String urlFileName = url.getFile();
}
}
import java.io.*;
public class test
{
public static void main(String[] args){
URL url = null;
URLConnection urlCon;
InputStream inStream;//你只需判断这个变量值 .
try{
url = new URL("http","www13.kaxiu.com",80,"modules/959908432/hua_cs.html");
urlCon = url.openConnection();
inStream = urlCon.getInputStream();
}
catch(MalformedURLException e){}
catch(java.io.IOException e2){}
String urlFileName = url.getFile();
}
}
-= 资 源 教 程 =-
文 章 搜 索