From 944ced70e1e2f889eafe6b169a9c69396ae8cbee Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 1 Nov 2022 21:23:33 +0700 Subject: Span-based TlsStream methods --- crypto/src/tls/TlsStream.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'crypto/src/tls/TlsStream.cs') diff --git a/crypto/src/tls/TlsStream.cs b/crypto/src/tls/TlsStream.cs index 01b990799..5c07da2bf 100644 --- a/crypto/src/tls/TlsStream.cs +++ b/crypto/src/tls/TlsStream.cs @@ -58,6 +58,13 @@ namespace Org.BouncyCastle.Tls return m_handler.ReadApplicationData(buffer, offset, count); } +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + public override int Read(Span buffer) + { + return m_handler.ReadApplicationData(buffer); + } +#endif + public override int ReadByte() { byte[] buf = new byte[1]; @@ -80,6 +87,13 @@ namespace Org.BouncyCastle.Tls m_handler.WriteApplicationData(buffer, offset, count); } +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + public override void Write(ReadOnlySpan buffer) + { + m_handler.WriteApplicationData(buffer); + } +#endif + public override void WriteByte(byte value) { m_handler.WriteApplicationData(new byte[]{ value }, 0, 1); -- cgit 1.4.1