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

Ensure all opened input streams are closed #2143

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

ansman
Copy link
Contributor

@ansman ansman commented Oct 10, 2024

No description provided.

@@ -53,7 +54,7 @@ abstract class PersistentMap<K, V>(
@OptIn(ExperimentalSerializationApi::class)
protected fun <K, V> deserialize(serializer: KSerializer<Map<K, V>>, storage: File): MutableMap<K, V> {
return if (storage.exists()) {
storage.inputStream().use {
BufferedInputStream(storage.inputStream()).use {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, Json.decodeFromStream doesn't buffer internally

@ting-yuan ting-yuan merged commit 5b6d886 into google:main Oct 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants