功能:Java以缓冲字符流读取文件内容并分割内容返回数组

    public String[] read_list_local(String files) throws Exception
    {
        File file =new File("D:\\javaxiangmu\\beiJinXinJian\\WebContent\\outfile"+File.separator+files);    //要读取的文件
        FileReader locla_file=new FileReader(file);
        BufferedReader input=new BufferedReader(locla_file);
        char bb[]=new char[1024];
        String []read_all=null;
        while(input.readLine()!=null){
            int lines=input.read(bb);
            String read=new String(bb,0,lines);
            read_all=read.split(",");    //将读取内容以,分割
        }
        return read_all;
    }

 

相关文章:

  • 2022-02-05
  • 2021-09-28
  • 2021-12-22
  • 2021-10-31
  • 2022-01-01
  • 2021-05-18
  • 2022-02-07
  • 2022-01-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案