public static byte[] Encode(ReadOnlySpan <byte> src) { int maxLen = SnappyWriter.GetMaxEncodedLen(src.Length); using (var dst = new RentedBuffer(maxLen)) { ReadOnlySpan <byte> compressed = SnappyWriter.Encode(dst.Span, src); return(compressed.ToArray()); } }
public static byte[] Decode(ReadOnlySpan <byte> src) { int dLen = SnappyReader.DecodedLen(src); using (var dst = new RentedBuffer(dLen)) { Span <byte> uncompressed = SnappyReader.Decode(dst.Span, src); return(uncompressed.ToArray()); } }
public RentedBuffer(RentedBuffer parent, int start, int count) { _parent = parent; _start = start; _count = count; }