diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-30 11:15:39 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-30 11:15:39 +0700 |
commit | 633b1a5da2e9ad5323397616dbee05b3d7de5739 (patch) | |
tree | 5048f252d70c5fceea0ffbde04afbd3ad9ec7539 /crypto/src/util | |
parent | Null tmpBuffers when disposing (diff) | |
download | BouncyCastle.NET-ed25519-633b1a5da2e9ad5323397616dbee05b3d7de5739.tar.xz |
Refactoring around MemoryStream
Diffstat (limited to 'crypto/src/util')
-rw-r--r-- | crypto/src/util/io/Streams.cs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/crypto/src/util/io/Streams.cs b/crypto/src/util/io/Streams.cs index 3623dfe39..e1da47fcd 100644 --- a/crypto/src/util/io/Streams.cs +++ b/crypto/src/util/io/Streams.cs @@ -117,29 +117,12 @@ namespace Org.BouncyCastle.Utilities.IO throw new ArgumentOutOfRangeException("count"); } - /// <exception cref="IOException"></exception> - public static void WriteBufTo(MemoryStream buf, Stream output) - { - buf.WriteTo(output); - } - /// <exception cref="IOException"></exception> public static int WriteBufTo(MemoryStream buf, byte[] output, int offset) { - int size = (int)buf.Length; - WriteBufTo(buf, new MemoryStream(output, offset, size)); + int size = Convert.ToInt32(buf.Length); + buf.WriteTo(new MemoryStream(output, offset, size)); return size; } - - public static void WriteZeroes(Stream outStr, long count) - { - byte[] zeroes = new byte[BufferSize]; - while (count > BufferSize) - { - outStr.Write(zeroes, 0, BufferSize); - count -= BufferSize; - } - outStr.Write(zeroes, 0, (int)count); - } } } |