Skip to content

Commit

Permalink
Merge pull request #2078 from moneymanagerex/saf
Browse files Browse the repository at this point in the history
Refactor: Use ByteStreams.copy instead of transferTo for backward compatibility
  • Loading branch information
guanlisheng authored Jan 14, 2025
2 parents 72ff434 + 64d9192 commit 9475245
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import androidx.appcompat.app.AppCompatActivity;

import java.nio.file.Files;

import com.google.common.io.ByteStreams;
import com.money.manager.ex.MmexApplication;
import com.money.manager.ex.core.RequestCodes;
import com.money.manager.ex.home.DatabaseMetadata;
Expand Down Expand Up @@ -251,7 +253,7 @@ private void downloadDatabase(Uri uri, String localPath) throws Exception {
if (is == null) {
throw new IOException("InputStream is null for URI: " + uri);
}
long bytesCopied = is.transferTo(os); // Stream API to copy bytes
long bytesCopied = ByteStreams.copy(is, os);
Timber.i("Copied %d bytes", bytesCopied);
} catch (Exception e) {
Timber.e(e, "Error downloading database");
Expand Down

0 comments on commit 9475245

Please sign in to comment.