KalleOlaviNiemitalo commented on code in PR #2439:
URL: https://github.com/apache/avro/pull/2439#discussion_r1295875980


##########
lang/csharp/src/apache/main/IO/BinaryDecoder.cs:
##########
@@ -26,14 +26,25 @@ namespace Avro.IO
     public partial class BinaryDecoder : Decoder, IDisposable
     {
         private readonly Stream stream;
+        private readonly bool ownStream;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="BinaryDecoder"/> 
class.
         /// </summary>
         /// <param name="stream">Stream to decode.</param>
-        public BinaryDecoder(Stream stream)
+        public BinaryDecoder(Stream stream) : this(stream, false)
+        {
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="BinaryDecoder"/> 
class.
+        /// </summary>
+        /// <param name="stream">Stream to decode.</param>
+        /// <param name="ownStream">Leave stream open after disposing the 
object.</param>

Review Comment:
   The [StreamReader 
constructor](https://learn.microsoft.com/dotnet/api/system.io.streamreader.-ctor?view=netstandard-2.0#system-io-streamreader-ctor(system-io-stream-system-text-encoding-system-boolean-system-int32-system-boolean))
 has a `bool leaveOpen` parameter for a similar purpose.  The default value is 
`false`.
   
   The [HttpClient 
constructor](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.-ctor?view=netstandard-2.0#system-net-http-httpclient-ctor(system-net-http-httpmessagehandler-system-boolean))
 instead has a `bool disposeHandler` parameter.  The default value is `true`.
   
   To preserve compatibility with earlier Avro versions while being easy to 
understand, I think this should be `bool disposeStream` and default to `false`. 
 The caller tells BinaryDecoder whether BinaryDecoder should dispose the stream.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to