保存文件

public void Download()
	{
		int byteRead=0;
		try
		{
			URL url=new URL(link);
			URLConnection conn=url.openConnection();
			InputStream is=conn.getInputStream();
			FileOutputStream os=new FileOutputStream(path);
			
			byte[] buffer=new byte[262144];
			while((byteRead=is.read(buffer))!=-1)
			{
				os.write(buffer,0,byteRead);
			}
		}
		catch(MalformedURLException me)
		{
			me.printStackTrace();
		}
		catch(IOException ie)
		{
			ie.printStackTrace();
		}		
	}

你可能感兴趣的:(java,OS,IE)