Code:
stringReader := strings.NewReader(pbMsg.GetBody().GetReqData().GetContent())
conBytes := make([]byte,1024)
snappyReader := snappy.NewReader(stringReader)
rNum, _ := snappyReader.Read(conBytes)
fmt.Println("rNum", rNum)
I use the snappy-go in a protobuf
project.The pb-string was compressed by snappy.
Now I want to to de-compress the string and get the pb-string, but when I use the *string.Reader
as a parameter the rNum
is 0
. Where's the error?
tips: pbMsg.GetBody().GetReqData().GetContent()
returns a string
(compressed by snappy).
thank you very much!!