FileDocCategorySizeDatePackage
CSVFile.javaAPI DocExample861Sun Feb 22 17:46:52 GMT 2004None

CSVFile

public class CSVFile extends Object
CSV in action: lines from a file and print.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

	
		// Construct a new CSV parser.
		CSV csv = new CSV();

		if (args.length == 0) {	// read standard input
			BufferedReader is = new BufferedReader(
				new InputStreamReader(System.in));
			process(csv, is);
		} else {
			for (int i=0; i<args.length; i++) {
				process(csv, new BufferedReader(new FileReader(args[i])));
			}
		}
	
protected static voidprocess(CSV csv, java.io.BufferedReader is)

		String line;
		while ((line = is.readLine()) != null) {
			System.out.println("line = `" + line + "'");
			Iterator e = csv.parse(line).iterator();
			int i = 0;
			while (e.hasNext()) 
				System.out.println("field[" + i++ + "] = `" +
					e.next() + "'");
		}