Skip to content
Snippets Groups Projects
Unverified Commit 36e65215 authored by Tiago Quelhas's avatar Tiago Quelhas Committed by GitHub
Browse files

[7.1.0] Avoid using `InputStream.available()` to detect EOF while reading...

[7.1.0] Avoid using `InputStream.available()` to detect EOF while reading delimited protos. (#21143)

It's not a reliable method to check for EOF: it returns how many bytes
are guaranteed to be read without blocking, and the base implementation
always returns 0.

Instead, leverage the fact that parseDelimitedFrom() returns null if the
stream is at EOF.

PiperOrigin-RevId: 602257598
Change-Id: I61e51774611196fb44745dc0aa2dc836b41fcd68
parent f3e0d5b9
Tags
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment