Replace "stream" in reader/writer classes' comments

XML documentation comments for JsonReader, JsonWriter and derived
classes often mention "underlying streams". In most cases however,
these types don't operate directly on Streams, but through other types
such as TextReader and TextWriter.

This commit changes these comments to reflect more accurately what
kind of objects the various JSON reader / writer classes operate on.

Additionally the effect of JsonReader.CloseInput and JsonWriter.Close-
Output is made more explicit in the comments for the Close methods.
This commit is contained in:
stakx
2016-12-24 02:26:16 +01:00
parent cf6a917a46
commit 1eb391c147
10 changed files with 62 additions and 57 deletions
+6 -5
View File
@@ -122,7 +122,7 @@ namespace Newtonsoft.Json.Bson
/// <summary>
/// Initializes a new instance of the <see cref="BsonReader"/> class.
/// </summary>
/// <param name="stream">The stream.</param>
/// <param name="stream">The <see cref="Stream"/> containing the BSON data to read.</param>
public BsonReader(Stream stream)
: this(stream, false, DateTimeKind.Local)
{
@@ -131,7 +131,7 @@ namespace Newtonsoft.Json.Bson
/// <summary>
/// Initializes a new instance of the <see cref="BsonReader"/> class.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="reader">The <see cref="BinaryReader"/> containing the BSON data to read.</param>
public BsonReader(BinaryReader reader)
: this(reader, false, DateTimeKind.Local)
{
@@ -140,7 +140,7 @@ namespace Newtonsoft.Json.Bson
/// <summary>
/// Initializes a new instance of the <see cref="BsonReader"/> class.
/// </summary>
/// <param name="stream">The stream.</param>
/// <param name="stream">The <see cref="Stream"/> containing the BSON data to read.</param>
/// <param name="readRootValueAsArray">if set to <c>true</c> the root object will be read as a JSON array.</param>
/// <param name="dateTimeKindHandling">The <see cref="DateTimeKind" /> used when reading <see cref="DateTime"/> values from BSON.</param>
public BsonReader(Stream stream, bool readRootValueAsArray, DateTimeKind dateTimeKindHandling)
@@ -155,7 +155,7 @@ namespace Newtonsoft.Json.Bson
/// <summary>
/// Initializes a new instance of the <see cref="BsonReader"/> class.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="reader">The <see cref="BinaryReader"/> containing the BSON data to read.</param>
/// <param name="readRootValueAsArray">if set to <c>true</c> the root object will be read as a JSON array.</param>
/// <param name="dateTimeKindHandling">The <see cref="DateTimeKind" /> used when reading <see cref="DateTime"/> values from BSON.</param>
public BsonReader(BinaryReader reader, bool readRootValueAsArray, DateTimeKind dateTimeKindHandling)
@@ -175,7 +175,7 @@ namespace Newtonsoft.Json.Bson
}
/// <summary>
/// Reads the next JSON token from the stream.
/// Reads the next JSON token from the underlying <see cref="Stream"/>.
/// </summary>
/// <returns>
/// <c>true</c> if the next token was read successfully; <c>false</c> if there are no more tokens to read.
@@ -224,6 +224,7 @@ namespace Newtonsoft.Json.Bson
/// <summary>
/// Changes the reader's state to <see cref="JsonReader.State.Closed"/>.
/// If <see cref="JsonReader.CloseInput"/> is set to <c>true</c>, the underlying <see cref="Stream"/> is also closed.
/// </summary>
public override void Close()
{
+5 -4
View File
@@ -62,7 +62,7 @@ namespace Newtonsoft.Json.Bson
/// <summary>
/// Initializes a new instance of the <see cref="BsonWriter"/> class.
/// </summary>
/// <param name="stream">The stream.</param>
/// <param name="stream">The <see cref="Stream"/> to write to.</param>
public BsonWriter(Stream stream)
{
ValidationUtils.ArgumentNotNull(stream, nameof(stream));
@@ -72,7 +72,7 @@ namespace Newtonsoft.Json.Bson
/// <summary>
/// Initializes a new instance of the <see cref="BsonWriter"/> class.
/// </summary>
/// <param name="writer">The writer.</param>
/// <param name="writer">The <see cref="BinaryWriter"/> to write to.</param>
public BsonWriter(BinaryWriter writer)
{
ValidationUtils.ArgumentNotNull(writer, nameof(writer));
@@ -80,7 +80,7 @@ namespace Newtonsoft.Json.Bson
}
/// <summary>
/// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.
/// Flushes whatever is in the buffer to the underlying <see cref="Stream"/> and also flushes the underlying stream.
/// </summary>
public override void Flush()
{
@@ -170,7 +170,8 @@ namespace Newtonsoft.Json.Bson
}
/// <summary>
/// Closes this stream and the underlying stream.
/// Closes this writer.
/// If <see cref="JsonWriter.CloseOutput"/> is set to <c>true</c>, the underlying <see cref="Stream"/> is also closed.
/// </summary>
public override void Close()
{
+12 -13
View File
@@ -141,12 +141,10 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Gets or sets a value indicating whether the underlying stream or
/// <see cref="TextReader"/> should be closed when the reader is closed.
/// Gets or sets a value indicating whether the source should be closed when this reader is closed.
/// </summary>
/// <value>
/// <c>true</c> to close the underlying stream or <see cref="TextReader"/> when
/// the reader is closed; otherwise <c>false</c>. The default is <c>true</c>.
/// <c>true</c> to close the source when this reader is closed; otherwise <c>false</c>. The default is <c>true</c>.
/// </value>
public bool CloseInput { get; set; }
@@ -406,13 +404,13 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream.
/// Reads the next JSON token from the source.
/// </summary>
/// <returns><c>true</c> if the next token was read successfully; <c>false</c> if there are no more tokens to read.</returns>
public abstract bool Read();
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Int32"/>.
/// Reads the next JSON token from the source as a <see cref="Nullable{T}"/> of <see cref="Int32"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Int32"/>. This method will return <c>null</c> at the end of an array.</returns>
public virtual int? ReadAsInt32()
@@ -463,7 +461,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="String"/>.
/// Reads the next JSON token from the source as a <see cref="String"/>.
/// </summary>
/// <returns>A <see cref="String"/>. This method will return <c>null</c> at the end of an array.</returns>
public virtual string ReadAsString()
@@ -507,7 +505,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Byte"/>[].
/// Reads the next JSON token from the source as a <see cref="Byte"/>[].
/// </summary>
/// <returns>A <see cref="Byte"/>[] or <c>null</c> if the next JSON token is null. This method will return <c>null</c> at the end of an array.</returns>
public virtual byte[] ReadAsBytes()
@@ -606,7 +604,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Double"/>.
/// Reads the next JSON token from the source as a <see cref="Nullable{T}"/> of <see cref="Double"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Double"/>. This method will return <c>null</c> at the end of an array.</returns>
public virtual double? ReadAsDouble()
@@ -668,7 +666,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Boolean"/>.
/// Reads the next JSON token from the source as a <see cref="Nullable{T}"/> of <see cref="Boolean"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Boolean"/>. This method will return <c>null</c> at the end of an array.</returns>
public virtual bool? ReadAsBoolean()
@@ -729,7 +727,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Decimal"/>.
/// Reads the next JSON token from the source as a <see cref="Nullable{T}"/> of <see cref="Decimal"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Decimal"/>. This method will return <c>null</c> at the end of an array.</returns>
public virtual decimal? ReadAsDecimal()
@@ -779,7 +777,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="DateTime"/>.
/// Reads the next JSON token from the source as a <see cref="Nullable{T}"/> of <see cref="DateTime"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="DateTime"/>. This method will return <c>null</c> at the end of an array.</returns>
public virtual DateTime? ReadAsDateTime()
@@ -835,7 +833,7 @@ namespace Newtonsoft.Json
#if !NET20
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.
/// Reads the next JSON token from the source as a <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>. This method will return <c>null</c> at the end of an array.</returns>
public virtual DateTimeOffset? ReadAsDateTimeOffset()
@@ -1124,6 +1122,7 @@ namespace Newtonsoft.Json
/// <summary>
/// Changes the reader's state to <see cref="JsonReader.State.Closed"/>.
/// If <see cref="JsonReader.CloseInput"/> is set to <c>true</c>, the source is also closed.
/// </summary>
public virtual void Close()
{
+4 -4
View File
@@ -994,7 +994,7 @@ namespace Newtonsoft.Json
/// <summary>
/// Serializes the specified <see cref="Object"/> and writes the JSON structure
/// to a <see cref="Stream"/> using the specified <see cref="TextWriter"/>.
/// using the specified <see cref="TextWriter"/>.
/// </summary>
/// <param name="textWriter">The <see cref="TextWriter"/> used to write the JSON structure.</param>
/// <param name="value">The <see cref="Object"/> to serialize.</param>
@@ -1005,7 +1005,7 @@ namespace Newtonsoft.Json
/// <summary>
/// Serializes the specified <see cref="Object"/> and writes the JSON structure
/// to a <see cref="Stream"/> using the specified <see cref="TextWriter"/>.
/// using the specified <see cref="JsonWriter"/>.
/// </summary>
/// <param name="jsonWriter">The <see cref="JsonWriter"/> used to write the JSON structure.</param>
/// <param name="value">The <see cref="Object"/> to serialize.</param>
@@ -1021,7 +1021,7 @@ namespace Newtonsoft.Json
/// <summary>
/// Serializes the specified <see cref="Object"/> and writes the JSON structure
/// to a <c>Stream</c> using the specified <see cref="TextWriter"/>.
/// using the specified <see cref="TextWriter"/>.
/// </summary>
/// <param name="textWriter">The <see cref="TextWriter"/> used to write the JSON structure.</param>
/// <param name="value">The <see cref="Object"/> to serialize.</param>
@@ -1037,7 +1037,7 @@ namespace Newtonsoft.Json
/// <summary>
/// Serializes the specified <see cref="Object"/> and writes the JSON structure
/// to a <c>Stream</c> using the specified <see cref="JsonWriter"/>.
/// using the specified <see cref="JsonWriter"/>.
/// </summary>
/// <param name="jsonWriter">The <see cref="JsonWriter"/> used to write the JSON structure.</param>
/// <param name="value">The <see cref="Object"/> to serialize.</param>
+10 -9
View File
@@ -359,7 +359,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream.
/// Reads the next JSON token from the underlying <see cref="TextReader"/>.
/// </summary>
/// <returns>
/// <c>true</c> if the next token was read successfully; <c>false</c> if there are no more tokens to read.
@@ -416,7 +416,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Int32"/>.
/// Reads the next JSON token from the underlying <see cref="TextReader"/> as a <see cref="Nullable{T}"/> of <see cref="Int32"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Int32"/>. This method will return <c>null</c> at the end of an array.</returns>
public override int? ReadAsInt32()
@@ -425,7 +425,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="DateTime"/>.
/// Reads the next JSON token from the underlying <see cref="TextReader"/> as a <see cref="Nullable{T}"/> of <see cref="DateTime"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="DateTime"/>. This method will return <c>null</c> at the end of an array.</returns>
public override DateTime? ReadAsDateTime()
@@ -434,7 +434,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="String"/>.
/// Reads the next JSON token from the underlying <see cref="TextReader"/> as a <see cref="String"/>.
/// </summary>
/// <returns>A <see cref="String"/>. This method will return <c>null</c> at the end of an array.</returns>
public override string ReadAsString()
@@ -443,7 +443,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Byte"/>[].
/// Reads the next JSON token from the underlying <see cref="TextReader"/> as a <see cref="Byte"/>[].
/// </summary>
/// <returns>A <see cref="Byte"/>[] or <c>null</c> if the next JSON token is null. This method will return <c>null</c> at the end of an array.</returns>
public override byte[] ReadAsBytes()
@@ -697,7 +697,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Boolean"/>.
/// Reads the next JSON token from the underlying <see cref="TextReader"/> as a <see cref="Nullable{T}"/> of <see cref="Boolean"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Boolean"/>. This method will return <c>null</c> at the end of an array.</returns>
public override bool? ReadAsBoolean()
@@ -945,7 +945,7 @@ namespace Newtonsoft.Json
#if !NET20
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.
/// Reads the next JSON token from the underlying <see cref="TextReader"/> as a <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>. This method will return <c>null</c> at the end of an array.</returns>
public override DateTimeOffset? ReadAsDateTimeOffset()
@@ -955,7 +955,7 @@ namespace Newtonsoft.Json
#endif
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Decimal"/>.
/// Reads the next JSON token from the underlying <see cref="TextReader"/> as a <see cref="Nullable{T}"/> of <see cref="Decimal"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Decimal"/>. This method will return <c>null</c> at the end of an array.</returns>
public override decimal? ReadAsDecimal()
@@ -964,7 +964,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Double"/>.
/// Reads the next JSON token from the underlying <see cref="TextReader"/> as a <see cref="Nullable{T}"/> of <see cref="Double"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Double"/>. This method will return <c>null</c> at the end of an array.</returns>
public override double? ReadAsDouble()
@@ -2402,6 +2402,7 @@ namespace Newtonsoft.Json
/// <summary>
/// Changes the reader's state to <see cref="JsonReader.State.Closed"/>.
/// If <see cref="JsonReader.CloseInput"/> is set to <c>true</c>, the underlying <see cref="TextReader"/> is also closed.
/// </summary>
public override void Close()
{
+3 -2
View File
@@ -163,7 +163,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.
/// Flushes whatever is in the buffer to the underlying <see cref="TextWriter"/> and also flushes the underlying <see cref="TextWriter"/>.
/// </summary>
public override void Flush()
{
@@ -171,7 +171,8 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Closes this stream and the underlying stream.
/// Closes this writer.
/// If <see cref="JsonWriter.CloseOutput"/> is set to <c>true</c>, the underlying <see cref="TextWriter"/> is also closed.
/// </summary>
public override void Close()
{
+9 -9
View File
@@ -392,7 +392,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Int32"/>.
/// Reads the next JSON token from the underlying <see cref="JsonReader"/> as a <see cref="Nullable{T}"/> of <see cref="Int32"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Int32"/>.</returns>
public override int? ReadAsInt32()
@@ -404,7 +404,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Byte"/>[].
/// Reads the next JSON token from the underlying <see cref="JsonReader"/> as a <see cref="Byte"/>[].
/// </summary>
/// <returns>
/// A <see cref="Byte"/>[] or <c>null</c> if the next JSON token is null.
@@ -418,7 +418,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Decimal"/>.
/// Reads the next JSON token from the underlying <see cref="JsonReader"/> as a <see cref="Nullable{T}"/> of <see cref="Decimal"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Decimal"/>.</returns>
public override decimal? ReadAsDecimal()
@@ -430,7 +430,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Double"/>.
/// Reads the next JSON token from the underlying <see cref="JsonReader"/> as a <see cref="Nullable{T}"/> of <see cref="Double"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Double"/>.</returns>
public override double? ReadAsDouble()
@@ -442,7 +442,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="Boolean"/>.
/// Reads the next JSON token from the underlying <see cref="JsonReader"/> as a <see cref="Nullable{T}"/> of <see cref="Boolean"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="Boolean"/>.</returns>
public override bool? ReadAsBoolean()
@@ -454,7 +454,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="String"/>.
/// Reads the next JSON token from the underlying <see cref="JsonReader"/> as a <see cref="String"/>.
/// </summary>
/// <returns>A <see cref="String"/>. This method will return <c>null</c> at the end of an array.</returns>
public override string ReadAsString()
@@ -466,7 +466,7 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="DateTime"/>.
/// Reads the next JSON token from the underlying <see cref="JsonReader"/> as a <see cref="Nullable{T}"/> of <see cref="DateTime"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="DateTime"/>. This method will return <c>null</c> at the end of an array.</returns>
public override DateTime? ReadAsDateTime()
@@ -479,7 +479,7 @@ namespace Newtonsoft.Json
#if !NET20
/// <summary>
/// Reads the next JSON token from the stream as a <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.
/// Reads the next JSON token from the underlying <see cref="JsonReader"/> as a <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.
/// </summary>
/// <returns>A <see cref="Nullable{T}"/> of <see cref="DateTimeOffset"/>.</returns>
public override DateTimeOffset? ReadAsDateTimeOffset()
@@ -492,7 +492,7 @@ namespace Newtonsoft.Json
#endif
/// <summary>
/// Reads the next JSON token from the stream.
/// Reads the next JSON token from the underlying <see cref="JsonReader"/>.
/// </summary>
/// <returns>
/// <c>true</c> if the next token was read successfully; <c>false</c> if there are no more tokens to read.
+5 -6
View File
@@ -119,12 +119,10 @@ namespace Newtonsoft.Json
private Formatting _formatting;
/// <summary>
/// Gets or sets a value indicating whether the underlying stream or
/// <see cref="TextReader"/> should be closed when the writer is closed.
/// Gets or sets a value indicating whether the destination should be closed when this writer is closed.
/// </summary>
/// <value>
/// <c>true</c> to close the underlying stream or <see cref="TextReader"/> when
/// the writer is closed; otherwise <c>false</c>. The default is <c>true</c>.
/// <c>true</c> to close the destination when this writer is closed; otherwise <c>false</c>. The default is <c>true</c>.
/// </value>
public bool CloseOutput { get; set; }
@@ -389,12 +387,13 @@ namespace Newtonsoft.Json
}
/// <summary>
/// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.
/// Flushes whatever is in the buffer to the destination and also flushes the destination.
/// </summary>
public abstract void Flush();
/// <summary>
/// Closes this stream and the underlying stream.
/// Closes this writer.
/// If <see cref="JsonWriter.CloseOutput"/> is set to <c>true</c>, the destination is also closed.
/// </summary>
public virtual void Close()
{
+1 -1
View File
@@ -65,7 +65,7 @@ namespace Newtonsoft.Json.Linq
}
/// <summary>
/// Reads the next JSON token from the stream.
/// Reads the next JSON token from the underlying <see cref="JToken"/>.
/// </summary>
/// <returns>
/// <c>true</c> if the next token was read successfully; <c>false</c> if there are no more tokens to read.
+7 -4
View File
@@ -52,9 +52,9 @@ namespace Newtonsoft.Json.Linq
}
/// <summary>
/// Gets the token being writen.
/// Gets the token being written.
/// </summary>
/// <value>The token being writen.</value>
/// <value>The token being written.</value>
public JToken Token
{
get
@@ -88,15 +88,18 @@ namespace Newtonsoft.Json.Linq
}
/// <summary>
/// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.
/// Flushes whatever is in the buffer to the underlying <see cref="JContainer"/>.
/// </summary>
public override void Flush()
{
}
/// <summary>
/// Closes this stream and the underlying stream.
/// Closes this writer.
/// </summary>
/// <remarks>
/// Setting <see cref="JsonWriter.CloseOutput"/> to <c>true</c> has no additional effect, since the underlying <see cref="JContainer"/> is a type that cannot be closed.
/// </remarks>
public override void Close()
{
base.Close();