Tweaks to decode interface

This commit is contained in:
Caleb Gardner
2022-12-17 16:47:33 -06:00
parent 1b5078c7bd
commit 4f8f5f6928
11 changed files with 87 additions and 75 deletions
+9 -2
View File
@@ -12,9 +12,16 @@ func (l Lz4) Reader(r io.Reader) (io.ReadCloser, error) {
return io.NopCloser(lz4.NewReader(r)), nil
}
func (l Lz4) Resetable() bool { return true }
func (l Lz4) Reset(old, src io.Reader) error {
old.(*lz4.Reader).Reset(src)
return nil
}
func (l Lz4) Decode(in []byte, outSize int) (out []byte, err error) {
out = make([]byte, outSize)
outLen, err := lz4.UncompressBlock(in, out)
if outLen < outSize {
out = out[:outLen]
}
return
}