缓存工具类

安卓开发一般都需要进行数据缓存,常用操作老司机已为你封装完毕,经常有小伙伴问怎么判断缓存是否可用,那我告诉你,你可以用这份工具进行存储和查询,具体可以查看源码,现在为你开车,Demo传送门

站点

缓存工具类 → AppACache

put : 保存String数据到缓存中
getAsString : 读取String数据
getAsJSONObject : 读取JSONObject数据
getAsJSONArray : 读取JSONArray数据
getAsBinary : 获取byte数据
getAsObject : 读取Serializable数据
getAsBitmap : 读取bitmap数据
getAsDrawable : 读取Drawable数据
file : 获取缓存文件
remove : 除某个key
clear : 清除所有数据

具体路线

public class AppACache {

// 用法例子
// ACache mCache = ACache.get(this); // 初始化,一般放在基类里
// mCache.put("test_key1","test value");
// mCache.put("test_key2", "test value", 10);// 保存10秒,如果超过10秒去获取这个key,将为null
// mCache.put("test_key3", "test value", 2 ACache.TIME_DAY);// 保存两天,如果超过两天去获取这个key,将为null
// String value = mCache.getAsString("test_key1");// 获取数据

public static final int TIME_HOUR = 60 * 60;
public static final int TIME_DAY = TIME_HOUR * 24;
private static final int MAX_SIZE = 1000 * 1000 * 50; // 50 mb
private static final int MAX_COUNT = Integer.MAX_VALUE; // 不限制存放数据的数量
private static Map<String, AppACache> mInstanceMap = new HashMap<String, AppACache>();
private ACacheManager mCache;

public static AppACache get(Context ctx) {
    return get(ctx, "ACache");
}

public static AppACache get(Context ctx, String cacheName) {
    File f = new File(ctx.getCacheDir(), cacheName);
    return get(f, MAX_SIZE, MAX_COUNT);
}

public static AppACache get(File cacheDir) {
    return get(cacheDir, MAX_SIZE, MAX_COUNT);
}

public static AppACache get(Context ctx, long max_zise, int max_count) {
    File f = new File(ctx.getCacheDir(), "ACache");
    return get(f, max_zise, max_count);
}

public static AppACache get(File cacheDir, long max_zise, int max_count) {
    AppACache manager = mInstanceMap.get(cacheDir.getAbsoluteFile() + myPid());
    if (manager == null) {
        manager = new AppACache(cacheDir, max_zise, max_count);
        mInstanceMap.put(cacheDir.getAbsolutePath() + myPid(), manager);
    }
    return manager;
}

private static String myPid() {
    return "_" + android.os.Process.myPid();
}

private AppACache(File cacheDir, long max_size, int max_count) {
    if (!cacheDir.exists() && !cacheDir.mkdirs()) {
        throw new RuntimeException("can't make dirs in "
                + cacheDir.getAbsolutePath());
    }
    mCache = new ACacheManager(cacheDir, max_size, max_count);
}

/**
 * Provides a means to save a cached file before the data are available.
 * Since writing about the file is complete, and its close method is called,
 * its contents will be registered in the cache. Example of use:
 *
 * ACache cache = new ACache(this) try { OutputStream stream =
 * cache.put("myFileName") stream.write("some bytes".getBytes()); // now
 * update cache! stream.close(); } catch(FileNotFoundException e){
 * e.printStackTrace() }
 */
class xFileOutputStream extends FileOutputStream {
    File file;

    public xFileOutputStream(File file) throws FileNotFoundException {
        super(file);
        this.file = file;
    }

    public void close() throws IOException {
        super.close();
        mCache.put(file);
    }
}

// =======================================
// ============ String数据 读写 ==============
// =======================================
/**
 * 保存 String数据 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的String数据
 */
public void put(String key, String value) {
    File file = mCache.newFile(key);
    BufferedWriter out = null;
    try {
        out = new BufferedWriter(new FileWriter(file), 1024);
        out.write(value);
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (out != null) {
            try {
                out.flush();
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        mCache.put(file);
    }
}

/**
 * 保存 String数据 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的String数据
 * @param saveTime
 *            保存的时间,单位:秒
 */
public void put(String key, String value, int saveTime) {
    put(key, Utils.newStringWithDateInfo(saveTime, value));
}

/**
 * 读取 String数据
 * 
 * @param key
 * @return String 数据
 */
public String getAsString(String key) {
    File file = mCache.get(key);
    if (!file.exists())
        return null;
    boolean removeFile = false;
    BufferedReader in = null;
    try {
        in = new BufferedReader(new FileReader(file));
        String readString = "";
        String currentLine;
        while ((currentLine = in.readLine()) != null) {
            readString += currentLine;
        }
        if (!Utils.isDue(readString)) {
            return Utils.clearDateInfo(readString);
        } else {
            removeFile = true;
            return null;
        }
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        if (removeFile)
            remove(key);
    }
}

// =======================================
// ============= JSONObject 数据 读写 ==============
// =======================================
/**
 * 保存 JSONObject数据 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的JSON数据
 */
public void put(String key, JSONObject value) {
    put(key, value.toString());
}

/**
 * 保存 JSONObject数据 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的JSONObject数据
 * @param saveTime
 *            保存的时间,单位:秒
 */
public void put(String key, JSONObject value, int saveTime) {
    put(key, value.toString(), saveTime);
}

/**
 * 读取JSONObject数据
 * 
 * @param key
 * @return JSONObject数据
 */
public JSONObject getAsJSONObject(String key) {
    String JSONString = getAsString(key);
    try {
        JSONObject obj = new JSONObject(JSONString);
        return obj;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

// =======================================
// ============ JSONArray 数据 读写 =============
// =======================================
/**
 * 保存 JSONArray数据 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的JSONArray数据
 */
public void put(String key, JSONArray value) {
    put(key, value.toString());
}

/**
 * 保存 JSONArray数据 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的JSONArray数据
 * @param saveTime
 *            保存的时间,单位:秒
 */
public void put(String key, JSONArray value, int saveTime) {
    put(key, value.toString(), saveTime);
}

/**
 * 读取JSONArray数据
 * 
 * @param key
 * @return JSONArray数据
 */
public JSONArray getAsJSONArray(String key) {
    String JSONString = getAsString(key);
    try {
        JSONArray obj = new JSONArray(JSONString);
        return obj;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

// =======================================
// ============== byte 数据 读写 =============
// =======================================
/**
 * 保存 byte数据 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的数据
 */
public void put(String key, byte[] value) {
    File file = mCache.newFile(key);
    FileOutputStream out = null;
    try {
        out = new FileOutputStream(file);
        out.write(value);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (out != null) {
            try {
                out.flush();
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        mCache.put(file);
    }
}

/**
 * Cache for a stream
 *
 * @param key
 *            the file name.
 * @return OutputStream stream for writing data.
 * @throws FileNotFoundException
 *             if the file can not be created.
 */
public OutputStream put(String key) throws FileNotFoundException {
    return new xFileOutputStream(mCache.newFile(key));
}

/**
 *
 * @param key
 *            the file name.
 * @return (InputStream or null) stream previously saved in cache.
 * @throws FileNotFoundException
 *             if the file can not be opened
 */
public InputStream get(String key) throws FileNotFoundException {
    File file = mCache.get(key);
    if (!file.exists())
        return null;
    return new FileInputStream(file);
}

/**
 * 保存 byte数据 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的数据
 * @param saveTime
 *            保存的时间,单位:秒
 */
public void put(String key, byte[] value, int saveTime) {
    put(key, Utils.newByteArrayWithDateInfo(saveTime, value));
}

/**
 * 获取 byte 数据
 * 
 * @param key
 * @return byte 数据
 */
public byte[] getAsBinary(String key) {
    RandomAccessFile RAFile = null;
    boolean removeFile = false;
    try {
        File file = mCache.get(key);
        if (!file.exists())
            return null;
        RAFile = new RandomAccessFile(file, "r");
        byte[] byteArray = new byte[(int) RAFile.length()];
        RAFile.read(byteArray);
        if (!Utils.isDue(byteArray)) {
            return Utils.clearDateInfo(byteArray);
        } else {
            removeFile = true;
            return null;
        }
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    } finally {
        if (RAFile != null) {
            try {
                RAFile.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        if (removeFile)
            remove(key);
    }
}

// =======================================
// ============= 序列化 数据 读写 ===============
// =======================================
/**
 * 保存 Serializable数据 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的value
 */
public void put(String key, Serializable value) {
    put(key, value, -1);
}

/**
 * 保存 Serializable数据到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的value
 * @param saveTime
 *            保存的时间,单位:秒
 */
public void put(String key, Serializable value, int saveTime) {
    ByteArrayOutputStream baos = null;
    ObjectOutputStream oos = null;
    try {
        baos = new ByteArrayOutputStream();
        oos = new ObjectOutputStream(baos);
        oos.writeObject(value);
        byte[] data = baos.toByteArray();
        if (saveTime != -1) {
            put(key, data, saveTime);
        } else {
            put(key, data);
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        try {
            oos.close();
        } catch (IOException e) {
        }
    }
}

/**
 * 读取 Serializable数据
 * 
 * @param key
 * @return Serializable 数据
 */
public Object getAsObject(String key) {
    byte[] data = getAsBinary(key);
    if (data != null) {
        ByteArrayInputStream bais = null;
        ObjectInputStream ois = null;
        try {
            bais = new ByteArrayInputStream(data);
            ois = new ObjectInputStream(bais);
            Object reObject = ois.readObject();
            return reObject;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            try {
                if (bais != null)
                    bais.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                if (ois != null)
                    ois.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    return null;

}

// =======================================
// ============== bitmap 数据 读写 =============
// =======================================
/**
 * 保存 bitmap 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的bitmap数据
 */
public void put(String key, Bitmap value) {
    put(key, Utils.Bitmap2Bytes(value));
}

/**
 * 保存 bitmap 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的 bitmap 数据
 * @param saveTime
 *            保存的时间,单位:秒
 */
public void put(String key, Bitmap value, int saveTime) {
    put(key, Utils.Bitmap2Bytes(value), saveTime);
}

/**
 * 读取 bitmap 数据
 * 
 * @param key
 * @return bitmap 数据
 */
public Bitmap getAsBitmap(String key) {
    if (getAsBinary(key) == null) {
        return null;
    }
    return Utils.Bytes2Bimap(getAsBinary(key));
}

// =======================================
// ============= drawable 数据 读写 =============
// =======================================
/**
 * 保存 drawable 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的drawable数据
 */
public void put(String key, Drawable value) {
    put(key, Utils.drawable2Bitmap(value));
}

/**
 * 保存 drawable 到 缓存中
 * 
 * @param key
 *            保存的key
 * @param value
 *            保存的 drawable 数据
 * @param saveTime
 *            保存的时间,单位:秒
 */
public void put(String key, Drawable value, int saveTime) {
    put(key, Utils.drawable2Bitmap(value), saveTime);
}

/**
 * 读取 Drawable 数据
 * 
 * @param key
 * @return Drawable 数据
 */
public Drawable getAsDrawable(String key) {
    if (getAsBinary(key) == null) {
        return null;
    }
    return Utils.bitmap2Drawable(Utils.Bytes2Bimap(getAsBinary(key)));
}

/**
 * 获取缓存文件
 * 
 * @param key
 * @return value 缓存的文件
 */
public File file(String key) {
    File f = mCache.newFile(key);
    if (f.exists())
        return f;
    return null;
}

/**
 * 移除某个key
 * 
 * @param key
 * @return 是否移除成功
 */
public boolean remove(String key) {
    return mCache.remove(key);
}

/**
 * 清除所有数据
 */
public void clear() {
    mCache.clear();
}

/**
 * @title 缓存管理器
 * @version 1.0
 */
public class ACacheManager {
    private final AtomicLong cacheSize;
    private final AtomicInteger cacheCount;
    private final long sizeLimit;
    private final int countLimit;
    private final Map<File, Long> lastUsageDates = Collections
            .synchronizedMap(new HashMap<File, Long>());
    protected File cacheDir;

    private ACacheManager(File cacheDir, long sizeLimit, int countLimit) {
        this.cacheDir = cacheDir;
        this.sizeLimit = sizeLimit;
        this.countLimit = countLimit;
        cacheSize = new AtomicLong();
        cacheCount = new AtomicInteger();
        calculateCacheSizeAndCacheCount();
    }

    /**
     * 计算 cacheSize和cacheCount
     */
    private void calculateCacheSizeAndCacheCount() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                int size = 0;
                int count = 0;
                File[] cachedFiles = cacheDir.listFiles();
                if (cachedFiles != null) {
                    for (File cachedFile : cachedFiles) {
                        size += calculateSize(cachedFile);
                        count += 1;
                        lastUsageDates.put(cachedFile,
                                cachedFile.lastModified());
                    }
                    cacheSize.set(size);
                    cacheCount.set(count);
                }
            }
        }).start();
    }

    private void put(File file) {
        int curCacheCount = cacheCount.get();
        while (curCacheCount + 1 > countLimit) {
            long freedSize = removeNext();
            cacheSize.addAndGet(-freedSize);

            curCacheCount = cacheCount.addAndGet(-1);
        }
        cacheCount.addAndGet(1);

        long valueSize = calculateSize(file);
        long curCacheSize = cacheSize.get();
        while (curCacheSize + valueSize > sizeLimit) {
            long freedSize = removeNext();
            curCacheSize = cacheSize.addAndGet(-freedSize);
        }
        cacheSize.addAndGet(valueSize);

        Long currentTime = System.currentTimeMillis();
        file.setLastModified(currentTime);
        lastUsageDates.put(file, currentTime);
    }

    private File get(String key) {
        File file = newFile(key);
        Long currentTime = System.currentTimeMillis();
        file.setLastModified(currentTime);
        lastUsageDates.put(file, currentTime);

        return file;
    }

    private File newFile(String key) {
        return new File(cacheDir, key.hashCode() + "");
    }

    private boolean remove(String key) {
        File image = get(key);
        return image.delete();
    }

    private void clear() {
        lastUsageDates.clear();
        cacheSize.set(0);
        File[] files = cacheDir.listFiles();
        if (files != null) {
            for (File f : files) {
                f.delete();
            }
        }
    }

    /**
     * 移除旧的文件
     * 
     * @return
     */
    private long removeNext() {
        if (lastUsageDates.isEmpty()) {
            return 0;
        }

        Long oldestUsage = null;
        File mostLongUsedFile = null;
        Set<Entry<File, Long>> entries = lastUsageDates.entrySet();
        synchronized (lastUsageDates) {
            for (Entry<File, Long> entry : entries) {
                if (mostLongUsedFile == null) {
                    mostLongUsedFile = entry.getKey();
                    oldestUsage = entry.getValue();
                } else {
                    Long lastValueUsage = entry.getValue();
                    if (lastValueUsage < oldestUsage) {
                        oldestUsage = lastValueUsage;
                        mostLongUsedFile = entry.getKey();
                    }
                }
            }
        }

        long fileSize = calculateSize(mostLongUsedFile);
        if (mostLongUsedFile.delete()) {
            lastUsageDates.remove(mostLongUsedFile);
        }
        return fileSize;
    }

    private long calculateSize(File file) {
        return file.length();
    }
}

/**
 * @title 时间计算工具类
 * @version 1.0
 */
private static class Utils {

    /**
     * 判断缓存的String数据是否到期
     * 
     * @param str
     * @return true:到期了 false:还没有到期
     */
    private static boolean isDue(String str) {
        return isDue(str.getBytes());
    }

    /**
     * 判断缓存的byte数据是否到期
     * 
     * @param data
     * @return true:到期了 false:还没有到期
     */
    private static boolean isDue(byte[] data) {
        String[] strs = getDateInfoFromDate(data);
        if (strs != null && strs.length == 2) {
            String saveTimeStr = strs[0];
            while (saveTimeStr.startsWith("0")) {
                saveTimeStr = saveTimeStr
                        .substring(1, saveTimeStr.length());
            }
            long saveTime = Long.valueOf(saveTimeStr);
            long deleteAfter = Long.valueOf(strs[1]);
            if (System.currentTimeMillis() > saveTime + deleteAfter * 1000) {
                return true;
            }
        }
        return false;
    }

    private static String newStringWithDateInfo(int second, String strInfo) {
        return createDateInfo(second) + strInfo;
    }

    private static byte[] newByteArrayWithDateInfo(int second, byte[] data2) {
        byte[] data1 = createDateInfo(second).getBytes();
        byte[] retdata = new byte[data1.length + data2.length];
        System.arraycopy(data1, 0, retdata, 0, data1.length);
        System.arraycopy(data2, 0, retdata, data1.length, data2.length);
        return retdata;
    }

    private static String clearDateInfo(String strInfo) {
        if (strInfo != null && hasDateInfo(strInfo.getBytes())) {
            strInfo = strInfo.substring(strInfo.indexOf(mSeparator) + 1,
                    strInfo.length());
        }
        return strInfo;
    }

    private static byte[] clearDateInfo(byte[] data) {
        if (hasDateInfo(data)) {
            return copyOfRange(data, indexOf(data, mSeparator) + 1,
                    data.length);
        }
        return data;
    }

    private static boolean hasDateInfo(byte[] data) {
        return data != null && data.length > 15 && data[13] == '-'
                && indexOf(data, mSeparator) > 14;
    }

    private static String[] getDateInfoFromDate(byte[] data) {
        if (hasDateInfo(data)) {
            String saveDate = new String(copyOfRange(data, 0, 13));
            String deleteAfter = new String(copyOfRange(data, 14,
                    indexOf(data, mSeparator)));
            return new String[] { saveDate, deleteAfter };
        }
        return null;
    }

    private static int indexOf(byte[] data, char c) {
        for (int i = 0; i < data.length; i++) {
            if (data[i] == c) {
                return i;
            }
        }
        return -1;
    }

    private static byte[] copyOfRange(byte[] original, int from, int to) {
        int newLength = to - from;
        if (newLength < 0)
            throw new IllegalArgumentException(from + " > " + to);
        byte[] copy = new byte[newLength];
        System.arraycopy(original, from, copy, 0,
                Math.min(original.length - from, newLength));
        return copy;
    }

    private static final char mSeparator = ' ';

    private static String createDateInfo(int second) {
        String currentTime = System.currentTimeMillis() + "";
        while (currentTime.length() < 13) {
            currentTime = "0" + currentTime;
        }
        return currentTime + "-" + second + mSeparator;
    }

    /*
     * Bitmap → byte[]
     */
    private static byte[] Bitmap2Bytes(Bitmap bm) {
        if (bm == null) {
            return null;
        }
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
        return baos.toByteArray();
    }

    /*
     * byte[] → Bitmap
     */
    private static Bitmap Bytes2Bimap(byte[] b) {
        if (b.length == 0) {
            return null;
        }
        return BitmapFactory.decodeByteArray(b, 0, b.length);
    }

    /*
     * Drawable → Bitmap
     */
    private static Bitmap drawable2Bitmap(Drawable drawable) {
        if (drawable == null) {
            return null;
        }
        // 取 drawable 的长宽
        int w = drawable.getIntrinsicWidth();
        int h = drawable.getIntrinsicHeight();
        // 取 drawable 的颜色格式
        Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
                : Bitmap.Config.RGB_565;
        // 建立对应 bitmap
        Bitmap bitmap = Bitmap.createBitmap(w, h, config);
        // 建立对应 bitmap 的画布
        Canvas canvas = new Canvas(bitmap);
        drawable.setBounds(0, 0, w, h);
        // 把 drawable 内容画到画布中
        drawable.draw(canvas);
        return bitmap;
    }

    /*
     * Bitmap → Drawable
     */
    @SuppressWarnings("deprecation")
    private static Drawable bitmap2Drawable(Bitmap bm) {
        if (bm == null) {
            return null;
        }
        return new BitmapDrawable(bm);
    }
}

}

终点站

好了,终点站到了,如果对本次旅途满意的话,请给五星好评哦,没关注的小伙伴轻轻点个上方的关注,毕竟老司机牺牲了很多时间才换来这么一份工具类,如果该工具类依赖其他工具类,都可以在我的史上最全的常用开发工具类收集(持续更新中)中找到。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 151,511评论 1 330
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 64,495评论 1 273
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 101,595评论 0 225
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 42,558评论 0 190
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 50,715评论 3 270
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 39,672评论 1 192
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,112评论 2 291
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 29,837评论 0 181
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 33,417评论 0 228
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 29,928评论 2 232
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,316评论 1 242
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 27,773评论 2 234
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,253评论 3 220
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 25,827评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,440评论 0 180
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 34,523评论 2 249
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 34,583评论 2 249

推荐阅读更多精彩内容