From 34480ae63045589541338c3def21c172418752c0 Mon Sep 17 00:00:00 2001 From: Elivo Date: Thu, 8 Jan 2026 17:57:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20Stream.Read(byte[])?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BA=8E=E8=AF=BB=E5=8F=96=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E7=9A=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Apewer/BytesUtility.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Apewer/BytesUtility.cs b/Apewer/BytesUtility.cs index 561608d..20b682c 100644 --- a/Apewer/BytesUtility.cs +++ b/Apewer/BytesUtility.cs @@ -702,6 +702,15 @@ namespace Apewer return Read(source, destination, (x) => { progress?.Invoke(x); return true; }, buffer); } + /// 读取流。 + /// + public static int Read(this Stream stream, byte[] buffer) + { + if (stream == null) throw new ArgumentNullException(nameof(stream)); + if (buffer == null) throw new ArgumentNullException(nameof(buffer)); + return stream.Read(buffer, 0, buffer.Length); + } + /// 读取源流中的数据。 /// 源流。 /// 缓冲区大小,最小值为 1。