summary refs log tree commit diff
path: root/crypto/src/tls/ByteQueueInputStream.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/tls/ByteQueueInputStream.cs')
-rw-r--r--crypto/src/tls/ByteQueueInputStream.cs20
1 files changed, 9 insertions, 11 deletions
diff --git a/crypto/src/tls/ByteQueueInputStream.cs b/crypto/src/tls/ByteQueueInputStream.cs
index 0b15071ad..ab26faa98 100644
--- a/crypto/src/tls/ByteQueueInputStream.cs
+++ b/crypto/src/tls/ByteQueueInputStream.cs
@@ -40,6 +40,15 @@ namespace Org.BouncyCastle.Tls
             return bytesToRead;
         }
 
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+        public override int Read(Span<byte> buffer)
+        {
+            int bytesToRead = System.Math.Min(m_buffer.Available, buffer.Length);
+            m_buffer.RemoveData(buffer[..bytesToRead], 0);
+            return bytesToRead;
+        }
+#endif
+
         public override int ReadByte()
         {
             if (m_buffer.Available == 0)
@@ -59,16 +68,5 @@ namespace Org.BouncyCastle.Tls
         {
             get { return m_buffer.Available; }
         }
-
-#if PORTABLE
-        //protected override void Dispose(bool disposing)
-        //{
-        //    base.Dispose(disposing);
-        //}
-#else
-        public override void Close()
-        {
-        }
-#endif
     }
 }