Class MtStream
- Namespace
- SharpPluginLoader.Core.IO
- Assembly
- SharpPluginLoader.Core.dll
Represents any kind of stream.
public class MtStream : MtObject
- Inheritance
-
MtStream
- Derived
- Inherited Members
Constructors
MtStream()
public MtStream()
MtStream(nint)
public MtStream(nint instance)
Parameters
instance
nint
Properties
Flags
The flags of the stream.
public ref uint Flags { get; }
Property Value
IsReadable
Whether the stream is readable.
public bool IsReadable { get; }
Property Value
IsSeekable
Whether the stream is seekable.
public bool IsSeekable { get; }
Property Value
IsWritable
Whether the stream is writable.
public bool IsWritable { get; }
Property Value
Length
Gets or sets the length of the stream.
public long Length { get; set; }
Property Value
Position
Gets the position of the stream.
public long Position { get; }
Property Value
Methods
Close()
Closes the stream.
public void Close()
Flush()
Flushes the stream.
public void Flush()
Read(long)
Reads the specified number of bytes from the stream.
public byte[] Read(long count)
Parameters
count
longThe 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>, long)
Reads the specified number of bytes from the stream.
public long Read(Span<byte> buffer, long count = -1)
Parameters
buffer
Span<byte>The buffer to read into.
count
longThe number of bytes to read. If -1, it will read bytes equal to the length of the buffer.
Returns
- long
The number of bytes read.
Seek(long, SeekOrigin)
Seeks to the specified position in the stream.
public long Seek(long offset, SeekOrigin origin)
Parameters
offset
longThe offset to seek to.
origin
SeekOriginThe origin to seek from.
Returns
- long
The new position in the stream.
Skip(long)
Skips the specified number of bytes in the stream.
public void Skip(long count)
Parameters
count
longThe number of bytes to skip.
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
- long
The number of bytes written.