import java.io.*;
import java.net.*;
public class HttpDownloader
{
public static void main( String[] args )
{
try
{
URL url = new URL("http://192.168.100.14/Index.doc");
URLConnection uc = url.openConnection();
uc.connect();
java.io.InputStream ins = uc.getInputStream();
File f = new File("aaa.doc");
java.io.FileOutputStream fos = new FileOutputStream(f);
int i;
while ((i=ins.read())!= -1)
{
fos.write(i);
}
ins.close();
fos.flush();
fos.close();
}
catch (IOException e)
{
e.printStackTrace ();
}
}
}
import java.net.*;
public class HttpDownloader
{
public static void main( String[] args )
{
try
{
URL url = new URL("http://192.168.100.14/Index.doc");
URLConnection uc = url.openConnection();
uc.connect();
java.io.InputStream ins = uc.getInputStream();
File f = new File("aaa.doc");
java.io.FileOutputStream fos = new FileOutputStream(f);
int i;
while ((i=ins.read())!= -1)
{
fos.write(i);
}
ins.close();
fos.flush();
fos.close();
}
catch (IOException e)
{
e.printStackTrace ();
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货