Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. 107458982 FFM00000000000713432CH
  2.  
  3. Key Filed --> 107458982FFM00000000000713432
  4.  
  5. private ArrayList<String> scannerRead4(String inFileUsed) {
  6. ArrayList<String> tempList = null;
  7. try {
  8. BufferedReader in = new BufferedReader(new FileReader(inFileUsed));
  9. try {
  10. String line;
  11. while ((line = in.readLine()) != null) {
  12. String[] s = line.split(" ");
  13.  
  14. for (int index=0;index<line.length()-1; index++) {
  15. System.out.println("s: " + s[index]);
  16. }
  17. //tempList = new ArrayList<String>(Arrays.asList(line.split(" ")));
  18. }
  19. } catch (IOException e) {
  20. e.printStackTrace();
  21. }
  22. } catch (FileNotFoundException e) {
  23. e.printStackTrace();
  24. }
  25. return tempList;
  26. }
  27.  
  28. 107458982 FFM00000000000713432CH
  29. 107462291 FFM00000000001835472T
  30.  
  31. 107462291 FFM00000000002200570T
  32.  
  33. 107462291 FFM00000000002432274T
  34.  
  35. 108018296 FFM00000000001431509T
  36.  
  37. 108018296 FFM00000000001553064T
  38.  
  39. 108122386 FFM00000000001211063T
  40.  
  41.  
  42. 108122386 FFM00000000001862517T
  43.  
  44.  
  45. 108491927 FFM00000000004556330T
  46.  
  47.  
  48. 108500569 FFM00000000001682124
  49.  
  50.  
  51. 108500569 FFM00000000002023040
  52.  
  53.  
  54. 108523927 FFM00000000000611642
  55.  
  56.  
  57. 108523927 FFM00000000002162127
  58.  
  59.  
  60. 108768840 FFM00000000001360865T
  61.  
  62.  
  63. 108768840 FFM00000000001796191T
  64.  
  65.  
  66. 108774203 FFM00000000001821871T
  67.  
  68.  
  69. 108774203 FFM00000000001946211T
  70.  
  71.  
  72. 108774203 FFM00000000001914770T
  73.  
  74. HashMap<String, String> map = new HashMap<String, String>();
  75.  
  76. StringBuffer key, value;
  77. char c;
  78. while ((c= in.read()) != null) {
  79. key = new StringBuffer();
  80.  
  81. if(c != " "){
  82. key.append(c);
  83. }else{
  84. value = new StringBuffer();
  85. while ((c= in.read()) == " ");//skip all the spaces
  86. value.append(c);//add last char found
  87.  
  88. //find rest of value until new line
  89. //may want to use System.getProperty("line.separator") or whatever the char value of new line is.
  90. while ((c= in.read()) != null && c != "n") {
  91. value.append(c);//add last char found
  92. }
  93.  
  94. map.put(key.toString(), value.toString());//map it all together
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement