Skip to content

Commit 32da01c

Browse files
shiftkeynulltoken
authored andcommitted
Drop optional parameters in BlobExtensions.cs
1 parent 40bbf1e commit 32da01c

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

LibGit2Sharp/BlobExtensions.cs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,44 @@ namespace LibGit2Sharp
99
/// </summary>
1010
public static class BlobExtensions
1111
{
12+
/// <summary>
13+
/// Gets the blob content, decoded with UTF8 encoding if the encoding cannot be detected from the byte order mark
14+
/// </summary>
15+
/// <param name="blob">The blob for which the content will be returned.</param>
16+
/// <returns>Blob content as text.</returns>
17+
public static string GetContentText(this Blob blob)
18+
{
19+
Ensure.ArgumentNotNull(blob, "blob");
20+
21+
return ReadToEnd(blob.GetContentStream(), null);
22+
}
23+
1224
/// <summary>
1325
/// Gets the blob content decoded with the specified encoding,
14-
/// or according to byte order marks, with UTF8 as fallback,
15-
/// if <paramref name="encoding"/> is null.
26+
/// or according to byte order marks, or the specified encoding as a fallback
1627
/// </summary>
1728
/// <param name="blob">The blob for which the content will be returned.</param>
18-
/// <param name="encoding">The encoding of the text. (default: detected or UTF8)</param>
29+
/// <param name="encoding">The encoding of the text to use, if it cannot be detected</param>
1930
/// <returns>Blob content as text.</returns>
20-
public static string GetContentText(this Blob blob, Encoding encoding = null)
31+
public static string GetContentText(this Blob blob, Encoding encoding)
2132
{
2233
Ensure.ArgumentNotNull(blob, "blob");
34+
Ensure.ArgumentNotNull(encoding, "encoding");
2335

2436
return ReadToEnd(blob.GetContentStream(), encoding);
2537
}
2638

39+
/// <summary>
40+
/// Gets the blob content, decoded with UTF8 encoding if the encoding cannot be detected
41+
/// </summary>
42+
/// <param name="blob">The blob for which the content will be returned.</param>
43+
/// <param name="filteringOptions">Parameter controlling content filtering behavior</param>
44+
/// <returns>Blob content as text.</returns>
45+
public static string GetContentText(this Blob blob, FilteringOptions filteringOptions)
46+
{
47+
return blob.GetContentText(filteringOptions, null);
48+
}
49+
2750
/// <summary>
2851
/// Gets the blob content as it would be checked out to the
2952
/// working directory, decoded with the specified encoding,
@@ -34,7 +57,7 @@ public static string GetContentText(this Blob blob, Encoding encoding = null)
3457
/// <param name="filteringOptions">Parameter controlling content filtering behavior</param>
3558
/// <param name="encoding">The encoding of the text. (default: detected or UTF8)</param>
3659
/// <returns>Blob content as text.</returns>
37-
public static string GetContentText(this Blob blob, FilteringOptions filteringOptions, Encoding encoding = null)
60+
public static string GetContentText(this Blob blob, FilteringOptions filteringOptions, Encoding encoding)
3861
{
3962
Ensure.ArgumentNotNull(blob, "blob");
4063
Ensure.ArgumentNotNull(filteringOptions, "filteringOptions");

0 commit comments

Comments
 (0)