Tusky-App-Android/app
Christophe Beyls 65af26993b
Optimize I/O code using Okio (#4366)
This pull request takes advantage of the Okio library to simplify, fix
or improve performance of some I/O related code in Tusky.

- Return early or throw `FileNotFoundException` early in case
`contentResolver.openInputStream()` returns `null` instead of throwing
`NullPointerException` later. Change the signature of
`Closeable.closeQuietly()` to only accept a non-null `Closeable`.
- Reimplement `Uri.copyToFile()` using Okio. This takes advantage of the
built-in high-performance buffers of the library so a buffer doesn't
need to be allocated or managed manually. The new implementation also
makes sure that the input and output streams are always closed, as the
original code could in some cases return without properly closing a
stream.
- Reimplement `ProgressRequestBody` as `Uri.asRequestBody()` (adding to
the existing extension functions available in the Okio library to create
a `RequestBody`). The new implementation uses Okio's `Buffer` instead of
a manually managed byte array, which allows to avoid copying bytes from
one buffer to the next. The max number of bytes read at once was
increased from 2K to 8K to improve performance. Avoid division by zero
in case `contentLength` is `0`. Finally, this implementation now takes a
`Uri` as input instead of an `InputStream`, because a `RequestBody` must
be replayable in case Okio retries the request, and an `InputStream` can
only be used once.
2024-04-10 21:52:55 +02:00
..
schemas/com.keylesspalace.tusky.db.AppDatabase Machine translation of posts (#4307) 2024-03-09 16:12:18 +01:00
src Optimize I/O code using Okio (#4366) 2024-04-10 21:52:55 +02:00
build.gradle add the correct information to regenerate the lint baseline file (#4351) 2024-04-02 21:02:51 +02:00
getGitSha.gradle Previous attempt to fix git sha on non-git build broke git build. (#3322) 2023-02-16 20:20:52 +01:00
lint-baseline.xml add the correct information to regenerate the lint baseline file (#4351) 2024-04-02 21:02:51 +02:00
lint.xml Fix some warnings & recreate lint-baseline.xml (#4278) 2024-02-25 16:20:26 +01:00
proguard-rules.pro Replace Gson library with Moshi (#4309) 2024-04-02 21:01:04 +02:00