Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 107458982 FFM00000000000713432CH
- Key Filed --> 107458982FFM00000000000713432
- private ArrayList<String> scannerRead4(String inFileUsed) {
- ArrayList<String> tempList = null;
- try {
- BufferedReader in = new BufferedReader(new FileReader(inFileUsed));
- try {
- String line;
- while ((line = in.readLine()) != null) {
- String[] s = line.split(" ");
- for (int index=0;index<line.length()-1; index++) {
- System.out.println("s: " + s[index]);
- }
- //tempList = new ArrayList<String>(Arrays.asList(line.split(" ")));
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- return tempList;
- }
- 107458982 FFM00000000000713432CH
- 107462291 FFM00000000001835472T
- 107462291 FFM00000000002200570T
- 107462291 FFM00000000002432274T
- 108018296 FFM00000000001431509T
- 108018296 FFM00000000001553064T
- 108122386 FFM00000000001211063T
- 108122386 FFM00000000001862517T
- 108491927 FFM00000000004556330T
- 108500569 FFM00000000001682124
- 108500569 FFM00000000002023040
- 108523927 FFM00000000000611642
- 108523927 FFM00000000002162127
- 108768840 FFM00000000001360865T
- 108768840 FFM00000000001796191T
- 108774203 FFM00000000001821871T
- 108774203 FFM00000000001946211T
- 108774203 FFM00000000001914770T
- HashMap<String, String> map = new HashMap<String, String>();
- StringBuffer key, value;
- char c;
- while ((c= in.read()) != null) {
- key = new StringBuffer();
- if(c != " "){
- key.append(c);
- }else{
- value = new StringBuffer();
- while ((c= in.read()) == " ");//skip all the spaces
- value.append(c);//add last char found
- //find rest of value until new line
- //may want to use System.getProperty("line.separator") or whatever the char value of new line is.
- while ((c= in.read()) != null && c != "n") {
- value.append(c);//add last char found
- }
- map.put(key.toString(), value.toString());//map it all together
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement