モノを使用してバイトを膨張/収縮させています。コードは次のとおりです。
public static byte[] Inflate(byte[] data)
{
using (MemoryStream inStream = new MemoryStream(data))
{
using (MemoryStream outStream = new MemoryStream())
{
using (DeflateStream decompressStream = new DeflateStream(inStream, CompressionMode.Decompress))
{
decompressStream.CopyTo(outStream);
}
return outStream.ToArray();
}
}
}
入力データは次のとおりです。アルゴリズムは DEFLATE です。
他のプラットフォームで同じデータを正常に膨張させましたが、上記のコードを使用すると、次の例外がスローされます。
System.IO.IOException: Corrupted data ReadInternal
at System.IO.Compression.DeflateStreamNative.CheckResult (Int32 result, System.String where) [0x00000] in <filename unknown>:0
at System.IO.Compression.DeflateStreamNative.ReadZStream (IntPtr buffer, Int32 length) [0x00000] in <filename unknown>:0
at System.IO.Compression.DeflateStream.ReadInternal (System.Byte[] array, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
at System.IO.Compression.DeflateStream.Read (System.Byte[] dest, Int32 dest_offset, Int32 count) [0x00000] in <filename unknown>:0
at System.IO.Stream.CopyTo (System.IO.Stream destination, Int32 bufferSize) [0x00000] in <filename unknown>:0
at System.IO.Stream.CopyTo (System.IO.Stream destination) [0x00000] in <filename unknown>:0