MtFileStream
Namespace: SharpPluginLoader.Core.IO
Represents a file stream.
public class MtFileStream : MtStream, System.IDisposable
Inheritance Object → NativeWrapper → MtObject → MtStream → MtFileStream
Implements IDisposable
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
MtFileStream(IntPtr)
public MtFileStream(nint instance)
Parameters
instance
IntPtr
MtFileStream()
public MtFileStream()
Methods
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, Boolean)
Opens a file stream from the specified path.
public static MtFileStream FromPath(string path, OpenMode mode, bool createPath)
Parameters
path
String
The path of the file.
mode
OpenMode
The mode to open the file in.
createPath
Boolean
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)
Parameters
str
String
The string to write.
encoding
Encoding
The encoding to use. If null, UTF8 will be used.
Returns
Int64
The number of bytes written.
Dispose()
public void Dispose()
Finalize()
protected void Finalize()