-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android - The file reading code is written with an error #427
Comments
@AleksMx hi, this has been answered multiple times. You can check here the explanation for your 1. and 3. points. As for the 2. that happens because if the user wants the data to be loaded into memory, the file has to be read back again into it — which isn’t impossible while caching unless I use the buffer array reader but it could result in out of memory exceptions as its not efficient compared to File input reader. I had no one reporting “a lot of errors” or even one with that class method, but if you found one, please post it with details and I’m happy to fix it. Thank you! |
If user wants the data to be loaded into memory, it is not necessary to cache the file. Because if you have content of the file, you don't need to have it's path. File should be flushed before reading it and not after. And if you close the file descriptor it's not necessary to flush it. |
@AleksMx flushing might make sense but I don’t get your first statement. One thing is the path, other is the content (bytes loaded into memory). |
Closing due to inactivity. Feel free to reopen if you still have this issue. Thank you! |
Plugin still have this issue. I fixed it locally. |
@AleksMx mind to issue a PR with it? Thanks! |
I encountered a strange behavior of the plugin. Sometimes when a user selects a file, the file is read broken.
So I looked at how the file is read.
In the method "public static FileInfo openFileStream(final Context context, final Uri uri, boolean withData)" of FileUtils class a lot of errors.
So, if a user selected a file for the first time and by the time it had not been flushed to disk, then the file will be read not all.
I have fixed the code. But I need to figure out what to do with caching. Why is it needed?
The text was updated successfully, but these errors were encountered: