Skip to content
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

fix: avoid android.os.strictmode.UnbufferedIoViolation by using BufferedInputStream #6565

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gubatron
Copy link

@gubatron gubatron commented Dec 5, 2024

  • Wrap InputStream with BufferedInputStream to ensure buffered I/O and prevent UnbufferedIoViolation in Android 14 (SDK 34).
  • Use try-with-resources to automatically close streams, improving resource management.
  • Retain existing functionality for converting InputStream to a UTF-8 string.

This change ensures compliance with Android 14's stricter I/O policies.
Many apps are about to up their target SDK to 34 and this comes up as soon as apps startup.

…redInputStream

- Wrap InputStream with BufferedInputStream to ensure buffered I/O and 
  prevent UnbufferedIoViolation in Android 14 (SDK 34).
- Use try-with-resources to automatically close streams, improving resource management.
- Retain existing functionality for converting InputStream to a UTF-8 string.

This change ensures compliance with Android 14's stricter I/O policies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants