You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking to use something like the byteReader approach for one of my projects, and looking at it a bit more closely, I see that the json package considers a call of byteReader.extend that returns 0 as EOF (see the call in Scanner.Next, for example). The documentation of Scanner.Next mentions that "If the stream is at its end, or an error has occurred, Next returns a zero length []byte slice."
However, it is possible that the underlying io.Reader returns 0, nil as a call to Read, which indicates that no data is available but no error was encountered, in which case a number of retries should probably happen in byteReader.extend? I'm thinking something like what is done in bufio.Reader.fill.
It's possible that I'm missing something and the io.Reader in byteReader is always expected to be of a certain type that guarantees no empty reads (without error) or something like that.
Thanks,
Martin
The text was updated successfully, but these errors were encountered:
Hello,
I'm looking to use something like the
byteReader
approach for one of my projects, and looking at it a bit more closely, I see that thejson
package considers a call ofbyteReader.extend
that returns0
asEOF
(see the call inScanner.Next
, for example). The documentation ofScanner.Next
mentions that "If the stream is at its end, or an error has occurred, Next returns a zero length []byte slice."However, it is possible that the underlying
io.Reader
returns0, nil
as a call toRead
, which indicates that no data is available but no error was encountered, in which case a number of retries should probably happen inbyteReader.extend
? I'm thinking something like what is done inbufio.Reader.fill
.It's possible that I'm missing something and the
io.Reader
inbyteReader
is always expected to be of a certain type that guarantees no empty reads (without error) or something like that.Thanks,
Martin
The text was updated successfully, but these errors were encountered: