package com.example.upload01;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class CSV_read 
{
	
/*
	"1.0.0.0","1.0.0.255","16777216","16777471","AU","Australia"
	"1.0.1.0","1.0.3.255","16777472","16778239","CN","China"
	"1.0.4.0","1.0.7.255","16778240","16779263","AU","Australia"
	"1.0.8.0","1.0.15.255","16779264","16781311","CN","China"
	"1.0.16.0","1.0.31.255","16781312","16785407","JP","Japan"
	"1.0.32.0","1.0.63.255","16785408","16793599","CN","China"
	"1.0.64.0","1.0.127.255","16793600","16809983","JP","Japan"
	"1.0.128.0","1.0.255.255","16809984","16842751","TH","Thailand"
*/
	
	public static void readCsvFile(String fileName)
    {
	        BufferedReader br = null;
	        String line = "";
	        String cvsSplitBy = ",";
	        ArrayList<String> store = new ArrayList<String>();
	        List<String[]> addresses = new ArrayList<String[]>();
	        
	        try 
	        {
	            br = new BufferedReader(new FileReader(fileName));
	            while ((line = br.readLine()) != null)
	            {
	                // use comma as separator
	                String[] country = line.split(cvsSplitBy);
	                addresses.add(country);
	                //store.add(country);
	            }
	
	        } 
	        
	        catch (FileNotFoundException e) 
	        {
	            e.printStackTrace();
	        } 
	        
	        catch (IOException e)
	        {
	            e.printStackTrace();
	        } 
	        
	        finally 
	        {
	            if (br != null) 
	            {
	                try
	                {
	                    br.close();
	                } 
	                catch (IOException e)
	                {
	                    e.printStackTrace();
	                }
	            }
	        }

    }

	
	
}
