本文整理了Java中android.app.Application.openFileOutput()
方法的一些代码示例,展示了Application.openFileOutput()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.openFileOutput()
方法的具体详情如下:
包路径:android.app.Application
类名称:Application
方法名:openFileOutput
暂无
代码示例来源:origin: roomanl/AndroidDownload
@Override
public FileOutputStream openFileOutput(String name, int mode) throws FileNotFoundException {
Log.d(TAG,"----getBaseContext");
return app.openFileOutput(name, mode);
}
代码示例来源:origin: mapsforge/mapsforge
public FileOutputStream openFileOutput(String name, int mode) throws FileNotFoundException {
if (this.svgCacheDir != null) {
return new FileOutputStream(new File(this.svgCacheDir, name), mode == Context.MODE_APPEND);
}
return this.application.openFileOutput(name, mode);
}
代码示例来源:origin: gdpancheng/LoonAndroid3
public void setObject(String fileName, Serializable object) {
long time = System.currentTimeMillis();
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try {
fos = application.openFileOutput(fileName, Context.MODE_PRIVATE);
oos = new ObjectOutputStream(fos);
oos.writeObject(object);// 写入
} catch (Exception e) {
e.printStackTrace();;
} finally {
try {
if (fos != null) {
fos.close();
}
if (oos != null) {
oos.close();
}
} catch (IOException e) {
}
}
}
代码示例来源:origin: ywwynm/EverythingDone
private void createFileToShowFeedbackDialogNextLaunch() {
try {
FileOutputStream fos = mApplication.openFileOutput(
Def.Meta.FEEDBACK_ERROR_FILE_NAME, Context.MODE_PRIVATE);
fos.write(App.getApp().getString(R.string.qq_my_love).getBytes());
} catch (IOException e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: gdpancheng/LoonAndroid3
/**
* 保存文件到/data/data/package_name/files下 无法指定位置
*
* @author 潘城 gdpancheng@gmail.com 2012-6-27 下午12:49:55
* @param fileName
* @param properties
* 设定文件
*/
public static void saveConfigNoDirs(String fileName, Properties properties) {
try {
FileOutputStream s = Ioc.getIoc().getApplication().openFileOutput(fileName, Context.MODE_PRIVATE);
properties.store(s, "");
} catch (Exception e) {
Ioc.getIoc().getLogger().e(e.toString());
}
}
代码示例来源:origin: gdpancheng/LoonAndroid3
public static void setObject(String fileName, Serializable object) {
long time = System.currentTimeMillis();
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try {
fos = Ioc.getIoc().getApplication().openFileOutput(fileName, Context.MODE_PRIVATE);
oos = new ObjectOutputStream(fos);
oos.writeObject(object);// 写入
} catch (Exception e) {
Ioc.getIoc().getLogger().e(fileName + "数据存储到文件错误" + object);
} finally {
try {
if (fos != null) {
fos.close();
}
if (oos != null) {
oos.close();
}
} catch (IOException e) {
Ioc.getIoc().getLogger().e(fileName + "数据存储到文件错误" + object);
}
}
Ioc.getIoc().getLogger().d(fileName + " 序列化存储耗时为:" + (System.currentTimeMillis() - time));
}
内容来源于网络,如有侵权,请联系作者删除!