Open
Conversation
Untested! This assumes we have `compileSdkVersion 29` or higher. This copy method might be faster, or if noting else, less own code to maintain. I found this since the code scanner warned of potential memory leak (unclosed file descriptors) if copying fails. If using FileUtils won't work, we should add a `finally` block that ensures the Streams get closed and garbage collected.
Member
|
Thanks for the pull request, I'll get back to you about this once I've tested it. |
hsjoberg
reviewed
Mar 10, 2021
Member
There was a problem hiding this comment.
Not sure what FileUtils is referring to, I assume import org.apache.commons.io.FileUtils?
Apache Commons IO is currently not a dependency of the Java project, but could be added.
| } | ||
| in.close(); | ||
| out.close(); | ||
| FileUtils.copy(new FileInputStream(source), new FileOutputStream(destination)); |
Member
There was a problem hiding this comment.
- FileUtils.copy(new FileInputStream(source), new FileOutputStream(destination));
+ FileUtils.copy(new FileInputStream(sourceLocation), new FileOutputStream(targetLocation));2843ed1 to
5b9f752
Compare
ce95362 to
183c24b
Compare
eea19ec to
edb9b80
Compare
35daec7 to
51ec3e4
Compare
ecc4b42 to
91833d0
Compare
07e4213 to
9961675
Compare
0600257 to
25d96d6
Compare
aa1af8c to
121153d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Untested!
This assumes we have
compileSdkVersion 29or higher. This copy method might be faster, or if noting else, less own code to maintain.I found this since the code scanner warned of potential memory leak (unclosed file descriptors) if copying fails. If using FileUtils won't work, we should add a
finallyblock that ensures the Streams get closed and garbage collected.