LzmaStream Encoding Issues #508

Open
opened 2026-01-29 22:13:04 +00:00 by claunia · 0 comments
Owner

Originally created by @ds5678 on GitHub (Mar 20, 2022).

I assume I'm making a simple mistake. My code produces a zero-length array.

public static byte[] Compress(byte[] uncompressedBytes)
{
	LzmaEncoderProperties properties = new LzmaEncoderProperties();
	using MemoryStream inputStream = new MemoryStream(uncompressedBytes);
	using MemoryStream outputStream = new MemoryStream();
	using LzmaStream lzmaStream = new LzmaStream(properties, false, outputStream);
	inputStream.CopyTo(lzmaStream);
	return outputStream.ToArray();
}

Related: #612

Originally created by @ds5678 on GitHub (Mar 20, 2022). I assume I'm making a simple mistake. My code produces a zero-length array. ```cs public static byte[] Compress(byte[] uncompressedBytes) { LzmaEncoderProperties properties = new LzmaEncoderProperties(); using MemoryStream inputStream = new MemoryStream(uncompressedBytes); using MemoryStream outputStream = new MemoryStream(); using LzmaStream lzmaStream = new LzmaStream(properties, false, outputStream); inputStream.CopyTo(lzmaStream); return outputStream.ToArray(); } ``` Related: #612
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#508