All pastes #207648 Raw Edit

Unnamed

public text v1 · immutable
#207648 ·published 2006-10-18 03:08 UTC
rendered paste body
import java.io.*;
import java.net.*;
public class GetJar {
	public static void main(String args[]) throws Exception {
		URL url = new URL("http://www.moparscape.org/jar/mudclient135.jar");
		System.setProperty("http.agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060907 Firefox/1.5.0.7");
		URLConnection con = url.openConnection();
		InputStream in = con.getInputStream();
		FileOutputStream out = new FileOutputStream("mudclient135.jar", false);
		byte[] buffer = new byte[8129];
		int read = 0, length = con.getContentLength(), portion;
		while(read < length) {
			portion = in.read(buffer);
			out.write(buffer, 0, portion);
			read += portion;
		}
		out.close();
		in.close();
	}
}