mirror of https://github.com/FongMi/TV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1008 B
42 lines
1008 B
package com.fongmi.bear.utils;
|
|
|
|
import android.os.Environment;
|
|
|
|
import com.fongmi.bear.App;
|
|
|
|
import java.io.File;
|
|
import java.io.FileOutputStream;
|
|
|
|
public class FileUtil {
|
|
|
|
public static String getRootPath() {
|
|
return Environment.getExternalStorageDirectory().getAbsolutePath();
|
|
}
|
|
|
|
public static File getCacheDir() {
|
|
return App.get().getExternalCacheDir();
|
|
}
|
|
|
|
public static String getCachePath() {
|
|
return getCacheDir().getAbsolutePath();
|
|
}
|
|
|
|
public static File getCacheFile(String fileName) {
|
|
return new File(getCacheDir(), fileName);
|
|
}
|
|
|
|
public static File getJar() {
|
|
return getCacheFile("spider.jar");
|
|
}
|
|
|
|
public static File getLocal(String path) {
|
|
return new File(path.replace("file:/", getRootPath()));
|
|
}
|
|
|
|
public static void write(File file, byte[] data) throws Exception {
|
|
FileOutputStream fos = new FileOutputStream(file);
|
|
fos.write(data);
|
|
fos.flush();
|
|
fos.close();
|
|
}
|
|
}
|
|
|