package cn.sh.trys.action;
import java.net.*;
import java.io.*;
import java.util.List;
//import com.opensymphony.xwork.ActionSupport;
/**
* 概要
*/
public class CreateHtml {
public static void downWrite(String url) throws Exception{
//File file = new File("d:/workspace/try.sh.cn/root/index.html");
//File file = new File("d:/workspace/try.sh.cn/root/try.html");
File file = new File("d:/695.html");
// if(!file.exists()){
// file.mkdirs();
// }
if(file.exists()){
file.delete();
}
//URL urlM=new URL("http://imga.52enjoy.net/"+url);
URL urlM=new URL(url);
URLConnection urlcon=urlM.openConnection();
InputStream in=urlcon.getInputStream();
// int c;
// while (((c=in.read())!=-1)){
// System.out.println(c);
// }
System.out.println(in.read());
try {
FileOutputStream newFile = new FileOutputStream(file,true);
int c;
while (((c=in.read())!=-1)){
newFile.write(c);
}
newFile.close();
} catch(IOException e) {
System.out.println(e.getMessage());
}
}
public static void main(String args[]) throws Exception{
//String test = "http://try.sh.cn/index.try";
//String test = "http://try.sh.cn/listGoodsBySort.try";
String test = "http://try.sh.cn/index.try";
downWrite(test);
}
}