[ 
https://issues.apache.org/jira/browse/TINKERPOP-3161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18020776#comment-18020776
 ] 

ASF GitHub Bot commented on TINKERPOP-3161:
-------------------------------------------

andreachild commented on code in PR #3206:
URL: https://github.com/apache/tinkerpop/pull/3206#discussion_r2353747293


##########
gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphBinary/StreamExtensions.cs:
##########
@@ -59,6 +59,31 @@ public static async Task<byte> ReadByteAsync(this Stream 
stream, CancellationTok
             return readBuffer[0];
         }
 
+        /// <summary>
+        ///     Asynchronously writes a <see cref="sbyte"/> to a <see 
cref="Stream"/>.
+        /// </summary>
+        /// <param name="stream">The <see cref="Stream"/> to write the <see 
cref="sbyte"/> to.</param>
+        /// <param name="value">The <see cref="sbyte"/> to write.</param>
+        /// <param name="cancellationToken">The token to cancel the operation. 
The default value is None.</param>
+        public static async Task WriteSByteAsync(this Stream stream, sbyte 
value,
+            CancellationToken cancellationToken = default)
+        {
+            await stream.WriteAsync(new[] {(byte)value}, 0, 1, 
cancellationToken).ConfigureAwait(false);
+        }

Review Comment:
   Can this delegate to existing WriteByteAsync?
   ```suggestion
           public static async Task WriteSByteAsync(this Stream stream, sbyte 
value,
               CancellationToken cancellationToken = default)
           {
               await stream.WriteByteAsync((byte)value, 
cancellationToken).ConfigureAwait(false);
           }
   ```





> Switched to signed bytes in .net
> --------------------------------
>
>                 Key: TINKERPOP-3161
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3161
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: dotnet
>    Affects Versions: 3.7.3
>            Reporter: Cole Greer
>            Priority: Critical
>              Labels: breaking
>
> The `Byte` type in our serializers represents a signed 8-bit integer (as this 
> is what byte in Java represents), however this currently maps to `byte` in 
> .net, which is an unsigned value. The .net serializers should be updated to 
> use `sbyte` instead, to be consistent with the rest of TinkerPop.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to