From 964821d1fc082a6c76d0fbd8189b468e100c68bf Mon Sep 17 00:00:00 2001 From: Sitterr Date: Fri, 15 Mar 2024 00:33:06 +0200 Subject: [PATCH] Wrapped GZipStream and ZlibStream in BufferedStream when reading --- SharpNBT/NbtFile.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SharpNBT/NbtFile.cs b/SharpNBT/NbtFile.cs index a6dae4f..d191c38 100644 --- a/SharpNBT/NbtFile.cs +++ b/SharpNBT/NbtFile.cs @@ -175,8 +175,8 @@ public static class NbtFile return compression switch { CompressionType.None => stream, - CompressionType.GZip => new GZipStream(stream, CompressionMode.Decompress, false), - CompressionType.ZLib => new ZLibStream(stream, CompressionMode.Decompress), + CompressionType.GZip => new BufferedStream(new GZipStream(stream, CompressionMode.Decompress, false)), + CompressionType.ZLib => new BufferedStream(new ZLibStream(stream, CompressionMode.Decompress)), _ => throw new ArgumentOutOfRangeException(nameof(compression), compression, null) }; }