Added forward raw

This commit is contained in:
M66B
2018-11-13 20:05:09 +01:00
parent e209df30c6
commit b968dacf15
5 changed files with 59 additions and 3 deletions

View File

@@ -23,8 +23,10 @@ import android.content.Context;
import android.util.Log;
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -81,6 +83,22 @@ public class EntityAttachment {
return new File(dir, Long.toString(id));
}
void write(Context context, String body) throws IOException {
File file = getFile(context, id);
BufferedWriter out = null;
try {
out = new BufferedWriter(new FileWriter(file));
out.write(body == null ? "" : body);
} finally {
if (out != null)
try {
out.close();
} catch (IOException e) {
Log.e(Helper.TAG, e + "\n" + Log.getStackTraceString(e));
}
}
}
void download(Context context, DB db) throws MessagingException, IOException {
// Build filename
File file = EntityAttachment.getFile(context, this.id);