Jump to content

User:Titoxd/sandbox

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Titoxd (talk | contribs) at 20:46, 15 January 2006 (code copy). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

import java.net.*;
import java.io.*;

import javax.swing.JOptionPane;

public class URLConnectionReader
{
	private static final String KILLURL = "http://en.wikipedia.org/w/index.php?title=Wikipedia:WikiProject_edit_counters/Flcelloguy%27s_Tool/Configs&action=raw";
	static String initURL = "http://en.wikipedia.org/w/index.php?title=Special:Contributions&target=";
	static String userName = "Titoxd";
	static String midURL = "&offset=0&limit=";
	static int limit = 10;
	
	public static void main(String[] args) throws Exception
	{
		//String finURL = KILLURL;
		String finURL = initURL + userName + midURL + limit;
		URL wikiUrl = new URL(finURL);
		URLConnection uc = wikiUrl.openConnection();
		uc.setReadTimeout(0);
		BufferedReader in = new BufferedReader(new InputStreamReader(uc
				.getInputStream()));
		
		String inputLine;
		FileWriter writer = new FileWriter("C:\\killText.txt");
		BufferedWriter out = new BufferedWriter(writer);

		while ((inputLine = in.readLine()) != null)
		{
			out.write(inputLine);
			out.newLine();
		}
		out.close();
		int c = JOptionPane.showConfirmDialog(null, "Hello");
		in.close();
	}
}