Android Open Source - android-heavy-list Cache Utils






From Project

Back to project page android-heavy-list.

License

The source code is released under:

Apache License

If you think the Android project android-heavy-list listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.m039.wf;
/*w w  w.ja  v  a  2  s  .c  o  m*/
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.File;
import java.io.FilenameFilter;

import java.util.ArrayList;
import java.util.List;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* Created: 25 March 2012
*
* @author <a href="mailto:flam44@gmail.com">Mozgin Dmitry</a>
* @version 1.0
*/

public class CacheUtils {
    static File ROOT = new File("/sdcard/ImageCache");

    static {
        ROOT.mkdir();
    }

    static void     clear() {
        if (ROOT.exists()) {
            FileUtils.delete(ROOT);
        }

        ROOT.mkdir();
    }

    static File     find(String name) {
        return new File(ROOT, name);
    }

    static Bitmap   get(File cache) {
        return BitmapFactory.decodeFile(cache.getAbsolutePath());
    }

    static void     put(Bitmap b, File cache) {
        BitmapUtils.saveBitmap(b, cache);
    }
}




Java Source Code List

com.m039.wf.BitmapUtils.java
com.m039.wf.CacheUtils.java
com.m039.wf.DemoActivity.java
com.m039.wf.FileUtils.java