zoukankan      html  css  js  c++  java
  • Android文本读写

       //写文件操作
       public void writeFileData(String fileName, String message){
            try{
                FileOutputStream fout = openFileOutput(fileName, MODE_PRIVATE);
                byte[] bytes = message.getBytes();
                fout.write(bytes);
                fout.close();
            }catch (Exception e){
                e.printStackTrace();
            }
        }

        //读文件操作
        public String readFileData(String fileName){
            String res = "";
            try {
                FileInputStream fin = openFileInput(fileName);
                int length = fin.available();
                byte[] buffer = new byte[length];
                fin.read(buffer);
                res = EncodingUtils.getString(buffer, "UTF-8");
                fin.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return res;
        }

  • 相关阅读:
    Codewars Solution:Two to One
    Codewars Solution:Get the Middle Character
    golang jwt+token验证
    C#基础知识点梳理二
    C#基础知识点梳理一
    逻辑值
    step-1
    视频第5讲-ID转换
    通过向量访问矩阵
    跟着jmzeng学习GEO数据分析-GEO42872_1--题外
  • 原文地址:https://www.cnblogs.com/xuandi/p/5091755.html
Copyright © 2011-2022 走看看