|
36 | 36 | namespace GameFrameX.Utility; |
37 | 37 |
|
38 | 38 | /// <summary> |
39 | | -/// 压缩解压缩辅助器。 |
| 39 | +/// Compression and decompression helper. |
40 | 40 | /// </summary> |
| 41 | +/// <remarks> |
| 42 | +/// 压缩解压缩辅助器。 |
| 43 | +/// </remarks> |
41 | 44 | public static class CompressionHelper |
42 | 45 | { |
43 | 46 | /// <summary> |
44 | | - /// 用于压缩和解压缩操作的缓冲区大小(以字节为单位) |
| 47 | + /// Buffer size in bytes for compression and decompression operations |
45 | 48 | /// </summary> |
| 49 | + /// <remarks> |
| 50 | + /// 用于压缩和解压缩操作的缓冲区大小(以字节为单位) |
| 51 | + /// </remarks> |
46 | 52 | private const int BufferSize = 8192; |
47 | 53 |
|
48 | 54 | /// <summary> |
49 | | - /// 压缩数据。使用Deflate算法将原始字节数组压缩成更小的字节数组。 |
| 55 | + /// Compresses data. Uses the Deflate algorithm to compress the original byte array into a smaller byte array. |
50 | 56 | /// </summary> |
51 | | - /// <param name="bytes">要压缩的原始字节数组。不能为null。</param> |
52 | | - /// <returns>压缩后的字节数组。如果输入为空数组,则直接返回该空数组。如果压缩过程中发生异常,则返回原始数组。</returns> |
53 | | - /// <exception cref="ArgumentNullException">当输入参数bytes为null时抛出。</exception> |
| 57 | + /// <remarks> |
| 58 | + /// 压缩数据。使用Deflate算法将原始字节数组压缩成更小的字节数组。 |
| 59 | + /// </remarks> |
| 60 | + /// <param name="bytes">The original byte array to be compressed. Cannot be null. / 要压缩的原始字节数组。不能为null。</param> |
| 61 | + /// <returns>The compressed byte array. If the input is an empty array, returns the empty array directly. If an exception occurs during compression, returns the original array. / 压缩后的字节数组。如果输入为空数组,则直接返回该空数组。如果压缩过程中发生异常,则返回原始数组。</returns> |
| 62 | + /// <exception cref="ArgumentNullException">Thrown when the input parameter bytes is null. / 当输入参数bytes为null时抛出。</exception> |
54 | 63 | public static byte[] Compress(byte[] bytes) |
55 | 64 | { |
56 | 65 | ArgumentNullException.ThrowIfNull(bytes, nameof(bytes)); |
@@ -90,12 +99,15 @@ public static byte[] Compress(byte[] bytes) |
90 | 99 | } |
91 | 100 |
|
92 | 101 | /// <summary> |
93 | | - /// 解压数据。使用Inflate算法将压缩的字节数组还原成原始字节数组。 |
| 102 | + /// Decompresses data. Uses the Inflate algorithm to restore the compressed byte array to the original byte array. |
94 | 103 | /// </summary> |
95 | | - /// <param name="bytes">要解压的压缩字节数组。不能为null。</param> |
96 | | - /// <returns>解压后的原始字节数组。如果输入为空数组,则直接返回该空数组。如果解压过程中发生异常,则返回原始数组。</returns> |
97 | | - /// <exception cref="ArgumentNullException">当输入参数bytes为null时抛出。</exception> |
98 | | - /// <exception cref="InvalidDataException">当压缩数据格式无效或已损坏时抛出。</exception> |
| 104 | + /// <remarks> |
| 105 | + /// 解压数据。使用Inflate算法将压缩的字节数组还原成原始字节数组。 |
| 106 | + /// </remarks> |
| 107 | + /// <param name="bytes">The compressed byte array to be decompressed. Cannot be null. / 要解压的压缩字节数组。不能为null。</param> |
| 108 | + /// <returns>The decompressed original byte array. If the input is an empty array, returns the empty array directly. If an exception occurs during decompression, returns the original array. / 解压后的原始字节数组。如果输入为空数组,则直接返回该空数组。如果解压过程中发生异常,则返回原始数组。</returns> |
| 109 | + /// <exception cref="ArgumentNullException">Thrown when the input parameter bytes is null. / 当输入参数bytes为null时抛出。</exception> |
| 110 | + /// <exception cref="InvalidDataException">Thrown when the compressed data format is invalid or corrupted. / 当压缩数据格式无效或已损坏时抛出。</exception> |
99 | 111 | public static byte[] Decompress(byte[] bytes) |
100 | 112 | { |
101 | 113 | ArgumentNullException.ThrowIfNull(bytes, nameof(bytes)); |
|
0 commit comments