Esempio n. 1
0
 /// <summary>Decodes data and immediately drains it into target buffer.</summary>
 /// <param name="decoder">Decoder.</param>
 /// <param name="source">Source buffer (with compressed data, to be decoded).</param>
 /// <param name="target">Target buffer (to drained into).</param>
 /// <param name="decoded">Number of bytes actually decoded.</param>
 /// <returns><c>true</c> decoder was drained, <c>false</c> otherwise.</returns>
 public static unsafe bool DecodeAndDrain(
     this ILZ4Decoder decoder,
     ReadOnlySpan <byte> source,
     Span <byte> target,
     out int decoded)
 {
     fixed(byte *sourceP = source)
     fixed(byte *targetP = target)
     return(decoder.DecodeAndDrain(
                sourceP, source.Length,
                targetP, target.Length,
                out decoded));
 }
Esempio n. 2
0
 /// <summary>Decodes data and immediately drains it into target buffer.</summary>
 /// <param name="decoder">Decoder.</param>
 /// <param name="source">Source buffer (with compressed data, to be decoded).</param>
 /// <param name="sourceOffset">Offset within source buffer.</param>
 /// <param name="sourceLength">Source buffer length.</param>
 /// <param name="target">Target buffer (to drained into).</param>
 /// <param name="targetOffset">Offset within target buffer.</param>
 /// <param name="targetLength">Target buffer length.</param>
 /// <param name="decoded">Number of bytes actually decoded.</param>
 /// <returns><c>true</c> decoder was drained, <c>false</c> otherwise.</returns>
 public static unsafe bool DecodeAndDrain(
     this ILZ4Decoder decoder,
     byte[] source, int sourceOffset, int sourceLength,
     byte[] target, int targetOffset, int targetLength,
     out int decoded)
 {
     fixed(byte *sourceP = source)
     fixed(byte *targetP = target)
     return(decoder.DecodeAndDrain(
                sourceP + sourceOffset,
                sourceLength,
                targetP + targetOffset,
                targetLength,
                out decoded));
 }