zcsizmadia commented on code in PR #2439:
URL: https://github.com/apache/avro/pull/2439#discussion_r1295849834
##########
lang/csharp/src/apache/main/IO/BinaryDecoder.cs:
##########
@@ -298,6 +309,10 @@ private void Skip(long p)
}
/// <inheritdoc />
- public void Dispose() => stream?.Dispose();
+ public void Dispose()
+ {
+ if(!ownStream)
Review Comment:
This condition IMO should be `if (ownStream) { stream?.Dispose(); }`
##########
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:
For me the ownStream name indicates that this object (BinaryDecoder) will
now takes ownership of the stream. So ownStream means "Stream is disposed when
this object is disposed".
--
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]