-
Notifications
You must be signed in to change notification settings - Fork 626
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
Add Json.decodeOneElement(bufferedSource: BufferedSource) #2854
Comments
It looks strange to me that there are two different types of data in the same stream. Do you have any real-world examples of such format? |
Wait shouldn't the normal Us three discussed this when the Okio integration was added: #1901 (comment) |
@JakeWharton that would work for me. I was kind of put towards @sandwwraith the specific case that made me open this issue is some old personal blog post format that I used 10 years ago where for some reason I used a JSON object instead of a front matter header 😄 . I wouldn't say it qualifies as very widespread but still a use case? |
@JakeWharton We discussed the usage of buffered sources there, and |
Okay. I guess I never really followed up on the actual behavior on that original PR. If the library is going to consume the entire source, there's really no point in accepting a Moshi and Wire accept a |
Hi 👋
This is a follow up from #1789.
There is now
decodeBufferedSourceToSequence()
but it doesn't work for arbitrary data:Can there be
decodeOneElement()
that leaves the bufferedSource open just after the parsedJsonElement
?The text was updated successfully, but these errors were encountered: