You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-24 23:16:47 +02:00
#62 SkipAndReturnBytes should support reader
This commit is contained in:
@ -70,6 +70,8 @@ type Iterator struct {
|
||||
buf []byte
|
||||
head int
|
||||
tail int
|
||||
captureStartedAt int
|
||||
captured []byte
|
||||
Error error
|
||||
}
|
||||
|
||||
@ -212,6 +214,11 @@ func (iter *Iterator) loadMore() bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
if iter.captureStartedAt != -1 {
|
||||
iter.captured = append(iter.captured,
|
||||
iter.buf[iter.captureStartedAt:iter.tail]...)
|
||||
iter.captureStartedAt = 0
|
||||
}
|
||||
for {
|
||||
n, err := iter.reader.Read(iter.buf)
|
||||
if n == 0 {
|
||||
|
Reference in New Issue
Block a user