How to split the large size .txt file data into small portion and insert into database?

后端 未结 2 1030
北海茫月
北海茫月 2021-01-25 01:35

Below is my code to read and split the text file content.

  try {

        br = new BufferedReader(new FileReader(\"F:\\\\Test.txt\"));
        final char[] cbuf         


        
2条回答
  •  我在风中等你
    2021-01-25 02:00

    Your doing it the hard way by not using readLine

        try {
            FileInputStream fis = new FileInputStream("F:\\Test.txt");
            reader = new BufferedReader(new InputStreamReader(fis));          
            String line = reader.readLine();
            while(line != null){
    
                //process your line here, it's just a String...   
    
                line = reader.readLine();
            }           
    
        } catch (FileNotFoundException ex) {
            ...
        } catch (IOException ex) {
    

提交回复
热议问题