GZipStream does have a CopyTo()

httptests
UbitUmarov 2017-05-06 18:25:07 +01:00
parent eb93855d84
commit 54eb6fc779
2 changed files with 14 additions and 14 deletions

View File

@ -163,19 +163,19 @@ namespace OpenSim.Data.MySQL
if (m_enableCompression)
{
using(GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data),
CompressionMode.Decompress))
using(MemoryStream ms = new MemoryStream(asset.Data))
using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress))
{
using(MemoryStream outputStream = new MemoryStream())
{
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
decompressionStream.CopyTo(outputStream, int.MaxValue);
// int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray();
asset.Data = outputStream.ToArray();
}
// m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
}
}
}
UpdateAccessTime(asset.Metadata, (int)dbReader["AccessTime"]);

View File

@ -173,18 +173,18 @@ namespace OpenSim.Data.PGSQL
if (m_enableCompression)
{
using (GZipStream decompressionStream = new GZipStream( new MemoryStream(asset.Data),
CompressionMode.Decompress))
using(MemoryStream ms = new MemoryStream(asset.Data))
using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress))
{
using(MemoryStream outputStream = new MemoryStream())
{
WebUtil.CopyStream(decompressionStream,outputStream,int.MaxValue);
// int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray();
}
// m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
decompressionStream.CopyTo(outputStream,int.MaxValue);
// int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray();
}
// m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
}
}