public static void cacheFile(File f, String type) { File cache = new File(Channels.cacheFile()); long ttd = System.currentTimeMillis() + (7 * 24 * 60 * 60); // now + 1week String data = "\n\r" + f.getAbsolutePath() + "," + String.valueOf(ttd) + "," + type + "\n\r"; try { FileOutputStream out = new FileOutputStream(cache, true); out.write(data.getBytes(), 0, data.length()); out.flush(); out.close(); } catch (Exception e) { } }