47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
|
#pragma warning disable
|
|
using System;
|
|
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls
|
|
{
|
|
/// <summary>OutputStream based on a ByteQueue implementation.</summary>
|
|
public sealed class ByteQueueOutputStream
|
|
: BaseOutputStream
|
|
{
|
|
private readonly ByteQueue m_buffer;
|
|
|
|
public ByteQueueOutputStream()
|
|
{
|
|
this.m_buffer = new ByteQueue();
|
|
}
|
|
|
|
public ByteQueue Buffer
|
|
{
|
|
get { return m_buffer; }
|
|
}
|
|
|
|
public override void Write(byte[] buffer, int offset, int count)
|
|
{
|
|
Streams.ValidateBufferArguments(buffer, offset, count);
|
|
|
|
m_buffer.AddData(buffer, offset, count);
|
|
}
|
|
|
|
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER || _UNITY_2021_2_OR_NEWER_
|
|
public override void Write(ReadOnlySpan<byte> buffer)
|
|
{
|
|
m_buffer.AddData(buffer);
|
|
}
|
|
#endif
|
|
|
|
public override void WriteByte(byte value)
|
|
{
|
|
m_buffer.AddData(new byte[]{ value }, 0, 1);
|
|
}
|
|
}
|
|
}
|
|
#pragma warning restore
|
|
#endif
|