Advertisement
Guest User

rink

a guest
Mar 24th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. public String[] citajDatoteku(String datoteka) {
  2. String[] splitStr = null;
  3. File file = new File(datoteka);
  4. if (file.exists() && !file.isDirectory()) {
  5. try {
  6. FileInputStream fs = new FileInputStream(file);
  7. int skipLines = 7;
  8. BufferedReader br = new BufferedReader(new InputStreamReader(fs));
  9. String line;
  10. try {
  11. while ((line = br.readLine()) != null) {
  12.  
  13. if (skipLines-- > 0) {
  14. continue;
  15. } else {
  16. splitStr = line.split("=");
  17. }
  18.  
  19. }
  20. } catch (IOException ex) {
  21. Logger.getLogger(RadnaDretva.class.getName()).log(Level.SEVERE, null, ex);
  22. }
  23.  
  24. } catch (FileNotFoundException ex) {
  25. Logger.getLogger(RadnaDretva.class.getName()).log(Level.SEVERE, null, ex);
  26. }
  27. } else {
  28. System.out.println("Datoteka ne postoji");
  29. }
  30.  
  31. return splitStr;
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement