You've already forked linux-packaging-mono
Imported Upstream version 6.4.0.137
Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
parent
e9207cf623
commit
ef583813eb
@@ -511,6 +511,20 @@ namespace System.IO {
|
||||
return chars;
|
||||
}
|
||||
|
||||
#if MONO
|
||||
public virtual int Read(Span<char> buffer)
|
||||
{
|
||||
char[] bufferBytes = buffer.ToArray();
|
||||
return Read(bufferBytes, 0, bufferBytes.Length);
|
||||
}
|
||||
|
||||
public virtual int Read(Span<byte> buffer)
|
||||
{
|
||||
byte[] bufferBytes = buffer.ToArray();
|
||||
return Read(bufferBytes, 0, bufferBytes.Length);
|
||||
}
|
||||
#endif
|
||||
|
||||
public virtual int Read(byte[] buffer, int index, int count) {
|
||||
if (buffer==null)
|
||||
throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
|
||||
|
||||
@@ -20,6 +20,7 @@ using System.Runtime;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.IO {
|
||||
// This abstract base class represents a writer that can write
|
||||
@@ -28,7 +29,7 @@ namespace System.IO {
|
||||
//
|
||||
[Serializable]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public class BinaryWriter : IDisposable
|
||||
public class BinaryWriter : IDisposable, IAsyncDisposable
|
||||
{
|
||||
public static readonly BinaryWriter Null = new BinaryWriter();
|
||||
|
||||
@@ -135,6 +136,45 @@ namespace System.IO {
|
||||
{
|
||||
return OutStream.Seek(offset, origin);
|
||||
}
|
||||
|
||||
#if MONO
|
||||
public virtual void Write(ReadOnlySpan<byte> buffer)
|
||||
{
|
||||
Write(buffer.ToArray());
|
||||
}
|
||||
|
||||
public virtual void Write(ReadOnlySpan<char> buffer)
|
||||
{
|
||||
Write(buffer.ToArray());
|
||||
}
|
||||
|
||||
public virtual ValueTask DisposeAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (GetType() == typeof(BinaryWriter))
|
||||
{
|
||||
if (_leaveOpen)
|
||||
{
|
||||
return new ValueTask(OutStream.FlushAsync());
|
||||
}
|
||||
|
||||
OutStream.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Since this is a derived BinaryWriter, delegate to whatever logic
|
||||
// the derived implementation already has in Dispose.
|
||||
Dispose();
|
||||
}
|
||||
return default;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
return new ValueTask(Task.FromException(exc));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Writes a boolean to this stream. A single byte is written to the stream
|
||||
// with the value 0 representing false or the value 1 representing true.
|
||||
|
||||
Reference in New Issue
Block a user