diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-09-03 00:36:40 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-09-03 00:36:40 +0700 |
commit | aa5f3f0929c50fc942325f18ed7ae48129d4c992 (patch) | |
tree | 0382f7336cb55c4a01bd38782d7694d1cb094921 /crypto/src/tls/ByteQueueInputStream.cs | |
parent | Clean up tests (diff) | |
download | BouncyCastle.NET-ed25519-aa5f3f0929c50fc942325f18ed7ae48129d4c992.tar.xz |
Stream modernization
Diffstat (limited to 'crypto/src/tls/ByteQueueInputStream.cs')
-rw-r--r-- | crypto/src/tls/ByteQueueInputStream.cs | 20 |
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 } } |