Example usage for android.content Context getFileStreamPath

List of usage examples for android.content Context getFileStreamPath

Introduction

In this page you can find the example usage for android.content Context getFileStreamPath.

Prototype

public abstract File getFileStreamPath(String name);

Source Link

Document

Returns the absolute path on the filesystem where a file created with #openFileOutput is stored.

Usage

From source file:Main.java

public static void removeFavNodes(Context cxt) {
    File data = cxt.getFileStreamPath(key_fav_nodes);
    data.delete();
}

From source file:Main.java

public static void removeLoginMember(Context cxt) {
    File data = cxt.getFileStreamPath(key_login_member);
    data.delete();
}

From source file:Main.java

public static void removeFileAccountInfo(Context ctx) {
    File accountFile = ctx.getFileStreamPath(ACCOUNT_PREFERENCE);
    if (accountFile != null && accountFile.exists()) {
        accountFile.delete();/*w  w w . j a va  2  s.  c  om*/
    }
}

From source file:Main.java

public static boolean isExistCache(Context context, String key) {
    File cache = context.getFileStreamPath(key);
    return cache.exists();
}

From source file:Main.java

public static void deleteCache(Context context, String key) {
    File cache = context.getFileStreamPath(key);
    if (cache.exists()) {
        cache.delete();/*from   ww  w  .ja va 2 s  .c  o m*/
    }
}

From source file:Main.java

public static boolean isCacheDataFailure(Context context, String cacheFile) {
    File data = context.getFileStreamPath(cacheFile);
    return !data.exists() || (System.currentTimeMillis() - data.lastModified()) > CACHE_TIME;
}

From source file:Main.java

public static boolean fileExists(Context ctx, String fileName) {
    try {// w  ww . ja va2 s  . c o  m
        return ctx.getFileStreamPath(fileName).exists();
    } catch (Exception e) {
        return false;
    }
}

From source file:Main.java

public static File getFileOutputStream(Context context, String dictFileName) throws IOException {
    File fos = context.getFileStreamPath(dictFileName);
    return fos;//from   ww w . j  a v a2 s  .c  o m
}

From source file:Main.java

public static boolean isFileExist(String filename, Context context) {
    boolean isExist = false;
    File file = context.getFileStreamPath(filename);
    if (file.exists()) {
        isExist = true;/*from   w w  w . jav a2  s.  co  m*/
    }
    return isExist;
}

From source file:Main.java

public static void writeUserInfo(String[] info, Context c) throws IOException {
    File f = c.getFileStreamPath(userInfoPath);
    if (!f.exists()) {
        f.createNewFile();//w ww .ja  v  a2  s.c  o m
    }

    String output = "";
    for (int n = 0; n < info.length; n++) {
        output += info[n] + eol + separator + eol;
    }
    BufferedWriter out = null;
    out = new BufferedWriter(new OutputStreamWriter(c.openFileOutput(userInfoPath, Context.MODE_PRIVATE)));

    out.write(output);
    out.flush();
    out.close();
    userInfo = info;
}