package org.cloudbus.cloudsim.codes.test.file;

import com.opencsv.CSVReader;
import org.cloudbus.cloudsim.File;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * ClassName CSVReaderExample
 * Description
 * Create by HW
 * Date 2021/11/24 17:56
 */
public class CSVReaderExample {
    public static void main(String[] args) {
        String file="E:\\研究生\\研究生\\论文\\cloudsim学习文档\\cloudsim-5 (2).0\\csvtest.csv";
        CSVReader reader=null;
        try {
            reader=new CSVReader(new FileReader(file));
            String[] line;
            while((line=reader.readNext()) != null){System.out.println("Country [id= " + line[0] + ", code= " + line[1] + " , name=" + line[2] + "]");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
