public static InputStream openCachedStream(URI uri) {
    TiResponseCache rc = (TiResponseCache) TiResponseCache.getDefault();
    if (rc == null) {
      return null;
    }

    if (rc.cacheDir == null) {
      return null;
    }

    String hash = DigestUtils.shaHex(uri.toString());
    File hFile = new File(rc.cacheDir, hash + HEADER_SUFFIX);
    File bFile = new File(rc.cacheDir, hash + BODY_SUFFIX);

    if (!bFile.exists() || !hFile.exists()) {
      return null;
    }

    try {
      return new FileInputStream(bFile);
    } catch (FileNotFoundException e) {
      // Fallback to URL download?
      return null;
    }
  }
  public static void remove(URI uri) {
    TiResponseCache rc = (TiResponseCache) TiResponseCache.getDefault();
    if (rc == null) return;
    if (rc.cacheDir == null) return;

    String hash = DigestUtils.shaHex(uri.toString());
    File hFile = new File(rc.cacheDir, hash + HEADER_SUFFIX);
    File bFile = new File(rc.cacheDir, hash + BODY_SUFFIX);
    if (bFile.exists()) bFile.delete();
    if (hFile.exists()) hFile.delete();
  }
  public static boolean peek(URI uri) {
    TiResponseCache rc = (TiResponseCache) TiResponseCache.getDefault();
    if (rc == null) return false;
    if (rc.cacheDir == null) return false;

    String hash = DigestUtils.shaHex(uri.toString());
    File hFile = new File(rc.cacheDir, hash + HEADER_SUFFIX);
    File bFile = new File(rc.cacheDir, hash + BODY_SUFFIX);
    if (!bFile.exists() || !hFile.exists()) return false;
    return true;
  }