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