Skip to content

Commit

Permalink
Encoder: add method Write(b []byte) (n int, err error)
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed Nov 23, 2022
1 parent b567262 commit 6c11dca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ func (e *Encoder) WriteBytes(b []byte, writeLength bool) error {
return e.toWriter(b)
}

func (e *Encoder) Write(b []byte) (n int, err error) {
e.count += len(b)
if traceEnabled {
zlog.Debug(" > encode: appending", zap.Stringer("hex", HexBytes(b)), zap.Int("pos", e.count))
}
return e.output.Write(b)
}

func (e *Encoder) WriteLength(length int) error {
if traceEnabled {
zlog.Debug("encode: write length", zap.Int("len", length))
Expand Down

0 comments on commit 6c11dca

Please sign in to comment.