|
@@ -202,20 +202,21 @@ public class ProfileManager {
|
|
|
*/
|
|
|
public void persistData(){
|
|
|
try {
|
|
|
+ int BUFFER_SIZE = 8192;
|
|
|
+ String UTF8 = "utf8";
|
|
|
+
|
|
|
FileOutputStream fout = MainActivity.getContext().openFileOutput(PERSIST_FILENAME, Context.MODE_PRIVATE);
|
|
|
- int BUFFER_SIZE = 8192;
|
|
|
- String UTF8 = "utf8";
|
|
|
+ BufferedWriter fnw = new BufferedWriter(new OutputStreamWriter(fout, UTF8), BUFFER_SIZE);
|
|
|
|
|
|
JSONArray arr = new JSONArray();
|
|
|
for(Profile p: mProfiles.values()){
|
|
|
arr.put(p.toJSON());
|
|
|
}
|
|
|
|
|
|
- fout.write(arr.toString().getBytes());
|
|
|
- BufferedWriter fnw = new BufferedWriter(new OutputStreamWriter(fout, UTF8), BUFFER_SIZE);
|
|
|
- fout.close();
|
|
|
- fnw.close();
|
|
|
+ fnw.write(arr.toString());
|
|
|
|
|
|
+ fnw.close();
|
|
|
+ fout.close();
|
|
|
} catch (FileNotFoundException e) {
|
|
|
e.printStackTrace();
|
|
|
} catch (IOException e) {
|