-Changed BsonReader/BsonWriter to close the underlying stream by default when closed
-Added CloseInput/CloseOutput to JsonReader/JsonWriter to control whether the underlying stream is closed. Default to true
This commit is contained in:
@@ -126,6 +126,16 @@ namespace Newtonsoft.Json
|
||||
private State _currentState;
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// true to close the underlying stream or <see cref="TextReader"/> when
|
||||
/// the writer is closed; otherwise false. The default is true.
|
||||
/// </value>
|
||||
public bool CloseOutput { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the top.
|
||||
/// </summary>
|
||||
@@ -179,12 +189,14 @@ namespace Newtonsoft.Json
|
||||
/// <summary>
|
||||
/// Creates an instance of the <c>JsonWriter</c> class.
|
||||
/// </summary>
|
||||
public JsonWriter()
|
||||
protected JsonWriter()
|
||||
{
|
||||
_stack = new List<JTokenType>(8);
|
||||
_stack.Add(JTokenType.None);
|
||||
_currentState = State.Start;
|
||||
_formatting = Formatting.None;
|
||||
|
||||
CloseOutput = true;
|
||||
}
|
||||
|
||||
private void Push(JTokenType value)
|
||||
|
||||
Reference in New Issue
Block a user