Table of Contents

Class MtFileStream

Namespace
SharpPluginLoader.Core.IO
Assembly
SharpPluginLoader.Core.dll

Represents a file stream.

public class MtFileStream : MtStream, IDisposable
Inheritance
MtFileStream
Implements
Inherited Members

Constructors

MtFileStream()

public MtFileStream()

MtFileStream(nint)

public MtFileStream(nint instance)

Parameters

instance nint

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

~MtFileStream()

protected ~MtFileStream()

FromFile(MtFile)

Creates a new file stream from the specified file.

public static MtFileStream? FromFile(MtFile file)

Parameters

file MtFile

The file to create the stream from.

Returns

MtFileStream

The created file stream, or null if the file stream could not be created.

FromPath(string, OpenMode, bool)

Opens a file stream from the specified path.

public static MtFileStream? FromPath(string path, OpenMode mode, bool createPath = true)

Parameters

path string

The path of the file.

mode OpenMode

The mode to open the file in.

createPath bool

Whether to create the path if it does not exist.

Returns

MtFileStream

The opened file stream, or null if the file stream could not be opened.

Write(string, Encoding?)

Writes the given string to the stream.

public long Write(string str, Encoding? encoding = null)

Parameters

str string

The string to write.

encoding Encoding

The encoding to use. If null, UTF8 will be used.

Returns

long

The number of bytes written.