@@ -0,0 +1,2874 @@
+package mlxy.utils;%0A%0Aimport android.content.Context;%0Aimport android.os.Environment;%0A%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.FileOutputStream;%0Aimport java.io.IOException;%0A%0Apublic class F %7B%0A%0A    public static File create(File file) throws IOException %7B%0A        if (file == null) %7B%0A            return null;%0A        %7D%0A%0A        File parent = file.getParentFile();%0A        if (!parent.exists()) %7B%0A            parent.mkdirs();%0A        %7D%0A        file.createNewFile();%0A        return file;%0A    %7D%0A%0A    public static File createTempFile(Context context, String filename) %7B%0A        try %7B%0A            return File.createTempFile(filename, null, getCacheDir(context));%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A            return null;%0A        %7D%0A    %7D%0A%0A    public static File getCacheDir(Context context) %7B%0A        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) %7B%0A            return context.getExternalCacheDir();%0A        %7D else %7B%0A            return context.getCacheDir();%0A        %7D%0A    %7D%0A%0A    public static File getFileDir(Context context) %7B%0A        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) %7B%0A            return context.getExternalFilesDir(Environment.DIRECTORY_PICTURES);%0A        %7D else %7B%0A            return context.getFilesDir();%0A        %7D%0A    %7D%0A%0A    public static boolean delete(File file) %7B%0A        boolean deleted = false;%0A%0A        if (file != null) %7B%0A            if (file.isFile()) %7B%0A                deleted = file.delete();%0A            %7D%0A        %7D%0A%0A        return deleted;%0A    %7D%0A%0A    public static boolean copy(File from, File to) %7B%0A        if (from == null %7C%7C to == null) %7B%0A            return false;%0A        %7D%0A%0A        if (!from.isFile() %7C%7C !from.canRead()) %7B%0A            return false;%0A        %7D%0A%0A        boolean copied = false;%0A%0A        FileInputStream input = null;%0A        FileOutputStream output = null;%0A        try %7B%0A            if (!to.isFile()) %7B%0A                create(to);%0A            %7D%0A%0A            input = new FileInputStream(from);%0A            output = new FileOutputStream(to);%0A%0A            byte%5B%5D buf = new byte%5B1024%5D;%0A            int len;%0A            while ((len = input.read(buf)) != -1) %7B%0A                output.write(buf, 0, len);%0A            %7D%0A%0A            copied = true;%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A            copied = false;%0A        %7D finally %7B%0A            if (input != null) %7B%0A                try %7B%0A                    input.close();%0A                %7D catch (IOException e) %7B%0A                    e.printStackTrace();%0A                %7D%0A            %7D%0A            if (output != null) %7B%0A                try %7B%0A                    output.close();%0A                %7D catch (IOException e) %7B%0A                    e.printStackTrace();%0A                %7D%0A            %7D%0A        %7D%0A%0A        return copied;%0A    %7D%0A%7D%0A

add file utils class F