MtStream
Namespace: SharpPluginLoader.Core.IO
Represents any kind of stream.
public class MtStream : SharpPluginLoader.Core.MtObject
Inheritance Object → NativeWrapper → MtObject → MtStream
Properties
Flags
The flags of the stream.
public UInt32& Flags { get; }
Property Value
IsReadable
Whether the stream is readable.
public bool IsReadable { get; }
Property Value
IsWritable
Whether the stream is writable.
public bool IsWritable { get; }
Property Value
IsSeekable
Whether the stream is seekable.
public bool IsSeekable { get; }
Property Value
Position
Gets the position of the stream.
public long Position { get; }
Property Value
Length
Gets or sets the length of the stream.
public long Length { get; set; }
Property Value
Instance
The native pointer.
public nint Instance { get; set; }
Property Value
Constructors
MtStream(IntPtr)
public MtStream(nint instance)
Parameters
instance
IntPtr
MtStream()
public MtStream()
Methods
Close()
Closes the stream.
public void Close()
Flush()
Flushes the stream.
public void Flush()
Read(Int64)
Reads the specified number of bytes from the stream.
public Byte[] Read(long count)
Parameters
count
Int64
The number of bytes to read.
Returns
Byte[]
The bytes read.
Exceptions
Exception
Thrown if the number of bytes read does not match the number of bytes requested.
Read(Span<Byte>, Int64)
Reads the specified number of bytes from the stream.
public long Read(Span<byte> buffer, long count)
Parameters
buffer
Span<Byte>
The buffer to read into.
count
Int64
The number of bytes to read. If -1, it will read bytes equal to the length of the buffer.
Returns
Int64
The number of bytes read.
Write(ReadOnlySpan<Byte>)
Writes the specified bytes to the stream.
public long Write(ReadOnlySpan<byte> buffer)
Parameters
buffer
ReadOnlySpan<Byte>
The bytes to write.
Returns
Int64
The number of bytes written.
Seek(Int64, SeekOrigin)
Seeks to the specified position in the stream.
public long Seek(long offset, SeekOrigin origin)
Parameters
offset
Int64
The offset to seek to.
origin
SeekOrigin
The origin to seek from.
Returns
Int64
The new position in the stream.
Skip(Int64)
Skips the specified number of bytes in the stream.
public void Skip(long count)
Parameters
count
Int64
The number of bytes to skip.