题目内容

___________数据是指那些存储在内存当中,有可能会因为程序关闭或其他原因导致内存被回收而丢失的数据,保存在运行内存中的数据就是处于此状态的。

查看答案
更多问题

___________就是指将那些内存中的瞬时数据保存到存储设备中,保证即使在手机或电脑关机的情况下,这些数据仍然不会丢失。

Android系统中主要提供了三种方式用于简单地实现数据持久化功能,即___________存储、___________存储以及___________存储。

请根据下面程序中注释在划线空白处填写代码。public void save() {String data = "Data to save";FileOutputStream out = null;BufferedWriter writer = null;try {// 以MODE_PRIVATE模式创建文件“data”的文件输出流对象out(1)_______________________________________________// 将out对象封装为OutputStreamWriter对象,// 然后再封装为BufferedWriter,保存到writer中(2)_______________________________________________// 将保存在data变量中的字符串写入到输出文件对象中(3)_______________________________________________} catch (IOException e) {e.printStackTrace();} finally {try {if( (4)__________________) {//如果writer对象不为空// 关闭文件输出对象(5)__________________}} catch (IOException e) {e.printStackTrace();}}}

请根据下面程序中注释在划线空白处填写代码。public String load() {FileInputStream in = null;BufferedReader reader = null;StringBuilder content = new StringBuilder();try {// 以默认模式创建文件“data”的文件输入流对象in(1)_______________________________________________// 将in对象封装为InputStreamReader对象,// 然后再封装为BufferedReader,保存到reader对象中(2)_______________________________________________String line = "";// 从文件中读取一行数据保存到字符串变量line中,当不为null时循环继续(3)while (__________________________________________) {// 将字符串变量line中数据添加到StringBuilder类对象content中(4)_________________________________________}} catch (IOException e) {e.printStackTrace();} finally {if (reader != null) {try {// 关闭文件读取对象(5)________________________} catch (IOException e) {e.printStackTrace();}}}return content.toString();}

答案查题题库