Skip to content

Commit

Permalink
add compatibility with flate.Reader
Browse files Browse the repository at this point in the history
  • Loading branch information
moredure committed Mar 9, 2021
1 parent 0036ca2 commit 2796331
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,12 @@ func (msg *Message) Read(p []byte) (int, error) {
msg.Body = msg.Body[n:]
return n, nil
}

func (msg *Message) ReadByte() (byte, error) {
if len(msg.Body) == 0 {
return 0, io.EOF
}
n := msg.Body[0]
msg.Body = msg.Body[1:]
return n, nil
}

0 comments on commit 2796331

Please sign in to comment.