Advertisement
Guest User

java oop

a guest
Aug 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3. import java.net.*;
  4.  
  5. public class Test {
  6. public static List<ProxyService> proxies = new ArrayList<ProxyService>();
  7.  
  8.  
  9. public static void main(String[] args) throws IOException{
  10. readProxies("C:\\Users\\samsung\\Desktop\\http-10000.txt");
  11.  
  12. }
  13.  
  14. public static void readProxies(String fileName) throws IOException {
  15. FileReader fr = new FileReader(fileName);
  16. BufferedReader br = new BufferedReader(fr);
  17. String s;
  18.  
  19. while ((s = br.readLine()) != null) {
  20. String[] spl = s.split(":");
  21. String host = spl[0];
  22. int port = Integer.parseInt(spl[1]);
  23. ProxyService ps = new ProxyService();
  24. ps.setHost(host);
  25. ps.setPort(port);
  26. proxies.add(ps);
  27. }
  28.  
  29. }
  30.  
  31. public static void setConnection(URL url) {
  32.  
  33. }
  34.  
  35. public static class ProxyService{
  36. private String host;
  37. private int port;
  38.  
  39. public String getHost() {
  40. return host;
  41. }
  42. public int getPort() {
  43. return port;
  44. }
  45.  
  46. public void setHost(String host) {
  47. this.host = host;
  48. }
  49.  
  50. public void setPort(int port) {
  51. this.port = port;
  52. }
  53. }
  54. }
  55.  
  56. class ProxyThread extends Thread {
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement