Conversation
…gger data files by saving them separately and saving a pointer into the database
Member
There was a problem hiding this comment.
I'm quiet sure this use of available() method is wrong.
Take a look to this:
https://docs.oracle.com/javase/7/docs/api/java/io/FileInputStream.html#available()
Member
There was a problem hiding this comment.
You need something like:
public static byte[] readAll(final InputStream is) throws IOException {
final ByteArrayOutputStream result = new ByteArrayOutputStream();
final byte[] buffer = new byte[16384];
int read;
while ((read = is.read(buffer, 0, buffer.length)) != -1) {
result.write(buffer, 0, read);
}
result.flush();
return result.toByteArray();
}
public static byte[] readAll(final File file) throws IOException {
try (final FileInputStream is = new FileInputStream(file)) {
return readAll(is);
}
}
Author
There was a problem hiding this comment.
Thank you very much @DiegoGomezDeck! Looks very much like you are right. I will consult with @DrakkLord and one of us will fix this.
Member
|
@krisoft any advances in this PR? |
Author
|
It's in our worklog, but the feature on our side which depends on this got a lower priority. So it might take a while until we come around fixing the issues you so kindly pointed out for us. I hope that doesn't cause any trouble. |
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.
Added ability to the android sql cache store to be able to contain bigger data files by saving them separately and saving a pointer into the database.
(This has been broken out from #153)