Advertisement
Guest User

Untitled

a guest
May 7th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. package main;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.File;
  5. import java.io.FileReader;
  6. import java.io.IOException;
  7. import java.util.ArrayList;
  8. import java.util.Scanner;
  9.  
  10. public class Load {
  11.  
  12. public static ArrayList<String> luser = new ArrayList<String>();
  13. public static ArrayList<String> lpassword = new ArrayList<String>();
  14. public static int linijki = 0;
  15.  
  16.  
  17. public static void load() throws IOException{
  18.  
  19. String path = "/home/tadzio/Pulpit/hasla.txt";
  20.  
  21.  
  22. File file = new File(path);
  23.  
  24. if(!file.exists()){
  25. System.out.println("Nie odnaleziono pliku");
  26. System.exit(0);
  27. } else {
  28. Scanner plik = new Scanner(new File(path));
  29. BufferedReader in = new BufferedReader(new FileReader(path));
  30. while(plik.hasNextLine()){
  31. linijki++;
  32. String account;
  33. account = plik.nextLine();
  34. String[] spl = new String(account).split(":");
  35. System.out.println(spl);
  36. String user = spl[0];
  37. String password = spl[1];
  38. System.out.println(user+"|"+password);
  39.  
  40. }
  41. System.out.println("Zaladowano "+linijki+" kont");
  42. plik.close();
  43. in.close();
  44.  
  45.  
  46. }
  47.  
  48.  
  49.  
  50. }
  51.  
  52.  
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement