noderank statistics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package com.mycompany.app;
  2. import java.io.BufferedReader;
  3. import java.io.File;
  4. import java.io.FileNotFoundException;
  5. import java.io.FileReader;
  6. import java.io.IOException;
  7. import java.util.Vector;
  8. //import org.json.simple.JSONArray;
  9. import org.json.simple.JSONObject;
  10. import org.json.simple.parser.JSONParser;
  11. import org.json.simple.parser.ParseException;
  12. /**
  13. * Hello world!
  14. *
  15. */
  16. public class App
  17. {
  18. public static void main(String[] args) {
  19. File file = new File("2016_05_05_05.txt"); // 파일 변수 file을 만든다
  20. Vector<String> IP = new Vector<String>(10);
  21. try {
  22. // BufferedReader 변수에 file을 넣는다
  23. BufferedReader reader = new BufferedReader(new FileReader(file));
  24. // 파일을 한줄씩 읽어 넣기 위한 변수 line
  25. String line = null;
  26. // 한 줄씩 읽어서 line에 넣은 후 null이 아니면 실행
  27. while( (line = reader.readLine()) != null ) {
  28. JSONParser jsonParser = new JSONParser();
  29. JSONObject jsonObject = new JSONObject();
  30. try {
  31. jsonObject = (JSONObject) jsonParser.parse(line);
  32. } catch (ParseException e) {
  33. // TODO Auto-generated catch block
  34. e.printStackTrace();
  35. }
  36. System.out.println("eip:"+jsonObject.get("eip"));
  37. if(!IP.contains(jsonObject.get("eip"))){
  38. IP.addElement((String)jsonObject.get("eip"));
  39. try {
  40. Class<?> clasis = Class.forName("Node");
  41. //Node server = (Node) clasis.newInstance();
  42. } catch (ClassNotFoundException e) {
  43. } catch (InstantiationException e) {
  44. } catch (IllegalAccessException e) {
  45. }
  46. }
  47. }
  48. reader.close();
  49. } catch (FileNotFoundException fnf) {
  50. fnf.printStackTrace();
  51. } catch( IOException e) {
  52. e.printStackTrace();
  53. }
  54. }
  55. }