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


功能: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;
    }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM