Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Commit

Permalink
added doc
Browse files Browse the repository at this point in the history
  • Loading branch information
SergejT34 committed Apr 1, 2022
1 parent 5373fcd commit c7999a6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions iter_str_copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import (
"errors"
)

// ReadStringToWriter read string from iterator and copyt to bufio.Writer.
// The []byte can not be kept, as it will change after next iterator call.
func (iter *Iterator) ReadStringToWriter(writer *bufio.Writer) (err error) {
c := iter.nextToken()
if c == '"' {
counter := 0
for i := iter.head; i < iter.tail; i++ {
// require ascii string and no escape
// for: field name, base64, number
if iter.buf[i] == '"' {
// fast path: reuse the underlying buffer
_, err = writer.Write(iter.buf[iter.head:i])
if err != nil {
return err
Expand Down

0 comments on commit c7999a6

Please sign in to comment.