Guest User

Untitled

a guest
Jun 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. try {
  2. fis = new FileInputStream(fName);
  3. } catch (FileNotFoundException ex) {
  4. //...
  5. }
  6.  
  7. DataInputStream myInput = new DataInputStream(fis);
  8. try {
  9. while (thisLine = myInput.readLine()) != null) {
  10. StringTokenizer st = new StringTokenizer(thisLine, ";");
  11. while (st.hasMoreElements()) {
  12. // do something with st.nextToken();
  13. }
  14. }
  15. } catch (Exception e) {
  16. //...
  17. }
  18.  
  19. DataInputStream d = new DataInputStream(in);
  20.  
  21. BufferedReader d
  22. = new BufferedReader(new InputStreamReader(in));
  23.  
  24. BufferedReader br = new BufferedReader (new InputStreamReader (source, charset);
  25. while (br.readLine () != null) { ... }
  26.  
  27. File myFile = ...
  28. List<String> lines = FileUtils.readLines(myFile, "UTF-8");
  29.  
  30. for (String line : lines) {
  31. StringTokenizer st = new StringTokenizer(line, ";");
  32. while (st.hasMoreElements()) {
  33. // do something with st.nextToken();
  34. }
  35. }
Add Comment
Please, Sign In to add comment