📄 principal.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package swoosh;import java.io.*;import java.util.*;import java.io.BufferedReader;import java.io.File;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;/** CSV in action: lines from a file and print. */public class principal { public static void main(String[] args) throws IOException { CSV csv = new CSV(); String arquivo="teste.cvs"; BufferedReader in = new BufferedReader(new FileReader("teste.cvs")); ArrayList row =process(csv, in); swoosh s=new swoosh(row); s.swoosh_execuçao(); } protected static String[] buildStringTokens(String s) { String[] result = new String[s.length()]; for (int i = 0; i < s.length(); i++) { result[i] = s.substring(i, i + 1); } return result; } protected static ArrayList process(CSV csv, BufferedReader is) throws IOException { String line; ArrayList row = new ArrayList(); ArrayList records = new ArrayList(); int i=1; while ((line = is.readLine()) != null) { // System.out.println("line = `" + line + "'"); Iterator e = csv.parse(line).iterator(); records.add(String.valueOf(i) ); i++; while (e.hasNext()) { line=(String )e.next(); line=line.replaceAll(" ", ""); records.add(line); } row.add(records); records=new ArrayList(); } imprime_lista(row); return(row); } protected static void imprime_lista(ArrayList list) { int i,j; System.out.println("Imprimindo tabela registros: "); for(i = 0; i < list.size(); i++ ) { ArrayList p = (ArrayList)list.get(i); System.out.println(""); for (j = 0; j < p.size(); j++) { System.out.print(" " + p.get(j).toString()); } } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -