package p1;
import java.io.File;
import java.io.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author sujith
*/
public class fileprgm {
public static void main(String[] args) {
File f1 = new File("e:\\data6.csv");
try {
BufferedReader br= new BufferedReader(new InputStreamReader(new FileInputStream(f1)));
String line;
List<String> ar = new ArrayList<String>();
while((line=br.readLine())!=null){
StringTokenizer st= new StringTokenizer(line,",");
while(st.hasMoreTokens()){
ar.add(st.nextToken());
}
}
Iterator<String> crunchifyIterator = ar.iterator();
while (crunchifyIterator.hasNext()) {
if(crunchifyIterator.hasNext()){
System.out.print(crunchifyIterator.next()+" ");
}
if(crunchifyIterator.hasNext()){
System.out.print(crunchifyIterator.next()+" ");
}
if(crunchifyIterator.hasNext()){
System.out.print(crunchifyIterator.next()+" ");
}
System.out.print("\n");
}
} catch (Exception ex) {
Logger.getLogger(msuppu.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
No comments:
Post a Comment