hc
2023-02-13 e440ec23c5a540cdd3f7464e8779219be6fd3d95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.rockchip.smart.rockhome;
 
import android.os.Environment;
 
import java.io.File;
import java.io.FileOutputStream;
 
/**
 * Created by GJK on 2018/12/5.
 */
 
public class Utils {
    public static void saveFile(String fileName, String str) {
        try {
            File file = new File("/mnt/sdcard", fileName);
            if (file.exists()) {
                file.delete();
            }
            file.createNewFile();
            FileOutputStream outStream = new FileOutputStream(file);
            outStream.write(str.getBytes());
            outStream.flush();
            outStream.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}