public String ReadFile(){ String content=null; try { FileInputStream fis=openFileInput("a.txt"); ByteArrayOutputStream baos=new ByteArrayOutputStream(); byte[] buffer=new byte[1024]; int bytes; while((bytes=fis.read(buffer,0,buffer.length))!=-1){ baos.write(buffer,0,bytes); } content=baos.toString(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
guichuideng
相关分类