4
4
using System . IO ;
5
5
using System . Linq ;
6
6
using System . Text ;
7
- using Properties ;
7
+ using Resources ;
8
8
9
9
/// <summary>
10
10
/// Represents the base class from which all implementations of binary-to-text
@@ -15,7 +15,7 @@ public abstract class BinaryToTextEncoding
15
15
/// <summary>
16
16
/// Gets <see cref="Environment.NewLine"/> as a sequence of bytes used as a
17
17
/// line separator within the
18
- /// <see cref="WriteLine(Stream, ReadOnlySpan {byte}, int, ref int)"/> and
18
+ /// <see cref="WriteLine(Stream, Span {byte}, int , int, ref int)"/> and
19
19
/// <see cref="WriteLine(Stream, byte, int, ref int)"/> methods.
20
20
/// </summary>
21
21
protected virtual ReadOnlyMemory < byte > Separator { get ; } = Encoding . UTF8 . GetBytes ( Environment . NewLine ) ;
@@ -357,7 +357,7 @@ public byte[] DecodeFile(string path)
357
357
}
358
358
359
359
/// <summary>
360
- /// Determines whether the specified character can be ignored.
360
+ /// Determines whether the specified value can be ignored.
361
361
/// </summary>
362
362
/// <param name="value">
363
363
/// The character to check.
@@ -380,7 +380,7 @@ protected static bool IsSkippable(int value, params int[] additional) =>
380
380
/// The stream in which to write the single byte.
381
381
/// </param>
382
382
/// <param name="bytes">
383
- /// An sequence of bytes.
383
+ /// A sequence of bytes.
384
384
/// </param>
385
385
/// <param name="count">
386
386
/// The number of bytes to be written to the current stream.
@@ -392,25 +392,23 @@ protected static bool IsSkippable(int value, params int[] additional) =>
392
392
/// The current position in the line.
393
393
/// </param>
394
394
/// <exception cref="ArgumentNullException">
395
- /// stream or buffer is null.
395
+ /// stream is null.
396
396
/// </exception>
397
397
/// <exception cref="ArgumentOutOfRangeException">
398
- /// count is less than 1.
398
+ /// count is less than 1, or greater than size of bytes .
399
399
/// </exception>
400
- protected void WriteLine ( Stream stream , ReadOnlySpan < byte > bytes , int count , int lineLength , ref int linePos )
400
+ protected void WriteLine ( Stream stream , Span < byte > bytes , int count , int lineLength , ref int linePos )
401
401
{
402
402
if ( stream == null )
403
403
throw new ArgumentNullException ( nameof ( stream ) ) ;
404
- if ( bytes == null )
405
- throw new ArgumentNullException ( nameof ( bytes ) ) ;
406
- if ( count < 1 )
404
+ if ( count < 1 || count > bytes . Length )
407
405
throw new ArgumentOutOfRangeException ( nameof ( count ) , count , null ) ;
408
406
for ( var i = 0 ; i < count ; i ++ )
409
407
WriteLine ( stream , bytes [ i ] , lineLength , ref linePos ) ;
410
408
}
411
409
412
- /// <inheritdoc cref="WriteLine(Stream, ReadOnlySpan {byte}, int, int, ref int)"/>
413
- protected void WriteLine ( Stream stream , ReadOnlySpan < byte > bytes , int lineLength , ref int linePos ) =>
410
+ /// <inheritdoc cref="WriteLine(Stream, Span {byte}, int, int, ref int)"/>
411
+ protected void WriteLine ( Stream stream , Span < byte > bytes , int lineLength , ref int linePos ) =>
414
412
WriteLine ( stream , bytes , bytes . Length , lineLength , ref linePos ) ;
415
413
416
414
/// <summary>
0 commit comments