Wrapped GZipStream and ZlibStream in BufferedStream when reading

This commit is contained in:
Sitterr 2024-03-15 00:33:06 +02:00
parent 190b694668
commit 964821d1fc
1 changed files with 2 additions and 2 deletions

View File

@ -175,8 +175,8 @@ public static class NbtFile
return compression switch return compression switch
{ {
CompressionType.None => stream, CompressionType.None => stream,
CompressionType.GZip => new GZipStream(stream, CompressionMode.Decompress, false), CompressionType.GZip => new BufferedStream(new GZipStream(stream, CompressionMode.Decompress, false)),
CompressionType.ZLib => new ZLibStream(stream, CompressionMode.Decompress), CompressionType.ZLib => new BufferedStream(new ZLibStream(stream, CompressionMode.Decompress)),
_ => throw new ArgumentOutOfRangeException(nameof(compression), compression, null) _ => throw new ArgumentOutOfRangeException(nameof(compression), compression, null)
}; };
} }