MCPcopy Index your code
hub / github.com/HDT3213/rdb / writeLZFString

Method writeLZFString

core/string.go:257–277  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

255}
256
257func (enc *Encoder) writeLZFString(s string) error {
258 out, err := lzf.Compress([]byte(s))
259 if err != nil {
260 return err
261 }
262 err = enc.write([]byte{encodeLZFPrefix})
263 if err != nil {
264 return err
265 }
266 // write compressed length
267 err = enc.writeLength(uint64(len(out)))
268 if err != nil {
269 return err
270 }
271 // write uncompressed length
272 err = enc.writeLength(uint64(len(s)))
273 if err != nil {
274 return err
275 }
276 return enc.write(out)
277}
278
279func (enc *Encoder) writeString(s string) error {
280 isInt, err := enc.tryWriteIntString(s)

Callers 2

writeStringMethod · 0.95
writeNanStringMethod · 0.95

Calls 3

writeMethod · 0.95
writeLengthMethod · 0.95
CompressFunction · 0.92

Tested by

no test coverage detected