mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-06 12:54:11 +01:00
Refactoring
This commit is contained in:
@@ -108,10 +108,14 @@ public class EntityMessage {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
void write(Context context, String body) throws IOException {
|
||||
static File getFile(Context context, Long id) {
|
||||
File dir = new File(context.getFilesDir(), "messages");
|
||||
dir.mkdir();
|
||||
File file = new File(dir, id.toString());
|
||||
return new File(dir, id.toString());
|
||||
}
|
||||
|
||||
void write(Context context, String body) throws IOException {
|
||||
File file = getFile(context, id);
|
||||
BufferedWriter out = null;
|
||||
try {
|
||||
out = new BufferedWriter(new FileWriter(file));
|
||||
@@ -131,8 +135,7 @@ public class EntityMessage {
|
||||
}
|
||||
|
||||
static String read(Context context, Long id) throws IOException {
|
||||
File dir = new File(context.getFilesDir(), "messages");
|
||||
File file = new File(dir, id.toString());
|
||||
File file = getFile(context, id);
|
||||
BufferedReader in = null;
|
||||
try {
|
||||
in = new BufferedReader(new FileReader(file));
|
||||
|
||||
Reference in New Issue
Block a user