createOutputStream(): allow to disable decryption

This commit is contained in:
Marc Schink 2019-12-20 19:07:31 +01:00
parent ef98a24bf6
commit cae124d93f
2 changed files with 3 additions and 12 deletions

View File

@ -53,20 +53,11 @@ public class AbstractConnectionManager {
}
}
public static OutputStream createAppendedOutputStream(DownloadableFile file) {
return createOutputStream(file, true);
}
public static OutputStream createOutputStream(DownloadableFile file) {
return createOutputStream(file, false);
}
private static OutputStream createOutputStream(DownloadableFile file, boolean append) {
public static OutputStream createOutputStream(DownloadableFile file, boolean append, boolean decrypt) {
FileOutputStream os;
try {
os = new FileOutputStream(file, append);
if (file.getKey() == null) {
if (file.getKey() == null || !decrypt) {
return os;
}
} catch (FileNotFoundException e) {

View File

@ -213,7 +213,7 @@ public class JingleConnection implements Transferable {
}
this.file.getParentFile().mkdirs();
this.file.createNewFile();
this.mFileOutputStream = AbstractConnectionManager.createOutputStream(this.file);
this.mFileOutputStream = AbstractConnectionManager.createOutputStream(this.file, false, true);
return this.mFileOutputStream;
}