All pastes #370215 Raw Edit

Anonymous

public java v1 · immutable
#370215 ·published 2007-02-24 11:08 UTC
rendered paste body
import java.io.*;import java.net.*;import java.util.LinkedList;public class ProxyTester {    public static void main(String[] args) throws IOException {    	try {    		outputList(tryProxies(getList(args[0])), args[1]);    		    	} catch(IOException e) {    		System.out.print("IOException: "+e.toString());    	}    }         private static LinkedList<String> getList(String arg) throws IOException {    	LinkedList<String> list = new LinkedList<String>();    	    	BufferedReader stdIn = new BufferedReader(new FileReader(arg));    	String inputProxies;    	while ((inputProxies = stdIn.readLine()) != null) {    		list.add(inputProxies);    	}    	stdIn.close();    	return list;    }        private static LinkedList<String> tryProxies(LinkedList<String> inputProxies) throws IOException {    	LinkedList<String> workingProxies = new LinkedList<String>();    	    	for(String currentProxy : inputProxies) {    		String tmp[] = currentProxy.split(":");    		if(connect(tmp[0], Integer.parseInt(tmp[1]))) {    			workingProxies.add(currentProxy);    		}    	}    	    	return workingProxies;    }        private static void outputList(LinkedList<String> workingProxies, String arg) throws IOException {    	BufferedWriter out = new BufferedWriter(new FileWriter(arg));    	    	for(String currentProxy : workingProxies) {    		out.write(currentProxy+"\n");    	}    	out.close();    }        private static boolean connect(String proxy, int port) throws IOException {    	return true;    }}