public static void Decompress(this Buffers fromBuffer, Buffers toBuffer) { MemoryStream buffer; while ((buffer = fromBuffer.GetBuffer()) != null) { //decompress data var decompressed = buffer.DeCompress(toBuffer.GetMemory()); toBuffer.EnqueueBuffer(decompressed); fromBuffer.ReleaseBuffer(buffer); ThreadMessage($"{buffer.Length} : {decompressed.Length}"); } }
public static void Compress(this Buffers fromBuffer, Buffers toBuffers) { MemoryStream buffer; while ((buffer = fromBuffer.GetBuffer()) != null) { var compressed = buffer.Compress(toBuffers.GetMemory()); compressed.Position = 0; toBuffers.EnqueueBuffer(compressed); fromBuffer.ReleaseBuffer(buffer); //buffer.Position = 0; //var position = buffer.ReadLong(); ThreadMessage($"{buffer.Length} : {compressed.Length}"); } }