KalleOlaviNiemitalo commented on code in PR #2439:
URL: https://github.com/apache/avro/pull/2439#discussion_r1293354478
##########
lang/csharp/src/apache/main/File/DeflateCodec.cs:
##########
@@ -58,18 +58,19 @@ public override void Compress(MemoryStream inputStream,
MemoryStream outputStrea
/// <inheritdoc/>
public override byte[] Decompress(byte[] compressedData, int length)
{
-
- MemoryStream inStream = new MemoryStream(compressedData);
- MemoryStream outStream = new MemoryStream();
-
- using (DeflateStream Decompress =
- new DeflateStream(inStream,
- CompressionMode.Decompress))
+ using (MemoryStream inStream = new MemoryStream(compressedData))
{
- CopyTo(Decompress, outStream);
+ using (MemoryStream outStream = new
MemoryStream(inStream.Capacity))
Review Comment:
Is `inStream.Capacity` worthwhile here? It's the compressed size, and the
uncompressed data that is written to `outStream` could be much larger. I guess
it won't hurt.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]