NativeStream Class
Namespace: Stride.Core.IOAssembly: Stride.Core.dll
A System.IO.Stream with additional methods for native read and write operations using System.IntPtr.
public abstract class NativeStream : Stream, IDisposable
Name | Description | |
---|---|---|
Fields | ||
nativeStreamBuffer | ||
NativeStreamBufferSize | ||
Methods | ||
Read(IntPtr, Int32) | Reads a block of bytes from the stream and writes the data in a given buffer. |
|
ReadUInt16() | ||
ReadUInt32() | ||
ReadUInt64() | ||
Write(IntPtr, Int32) | Writes a block of bytes to this stream using data from a buffer. |
|
Write(UInt16) | ||
Write(UInt32) | ||
Write(UInt64) |
Fields
nativeStreamBuffer
protected byte[] nativeStreamBuffer
Field Value
Type | Description |
---|---|
System.Byte[] |
NativeStreamBufferSize
protected const int NativeStreamBufferSize = 1024
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
Read(IntPtr, Int32)
Reads a block of bytes from the stream and writes the data in a given buffer.
public virtual int Read(IntPtr buffer, int count)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | buffer | When this method returns, contains the specified buffer with the values between 0 and (count - 1) replaced by the bytes read from the current source. |
System.Int32 | count | The maximum number of bytes to read. |
Returns
Type | Description |
---|---|
System.Int32 | The total number of bytes read into the buffer. This might be less than the number of bytes requested if that number of bytes are not currently available, or zero if the end of the stream is reached. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | array is null. |
ReadUInt16()
public virtual ushort ReadUInt16()
Returns
Type | Description |
---|---|
System.UInt16 |
ReadUInt32()
public virtual uint ReadUInt32()
Returns
Type | Description |
---|---|
System.UInt32 |
ReadUInt64()
public virtual ulong ReadUInt64()
Returns
Type | Description |
---|---|
System.UInt64 |
Write(IntPtr, Int32)
Writes a block of bytes to this stream using data from a buffer.
public virtual void Write(IntPtr buffer, int count)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | buffer | The buffer containing data to write to the stream. |
System.Int32 | count | The number of bytes to be written to the current stream. |
Write(UInt16)
public virtual void Write(ushort i)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | i |
Write(UInt32)
public virtual void Write(uint i)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | i |
Write(UInt64)
public virtual void Write(ulong i)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | i |