Class FileStream
A file stream.
Inheritance
Implements
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class FileStream : object, IFileStream
Constructors
FileStream(String)
Initializes a new instance of the File
Declaration
public FileStream(string path)
Parameters
Type | Name | Description |
---|---|---|
System. |
path | The path. |
Properties
Length
Gets the file length (must be opened first).
Declaration
public long Length { get; }
Property Value
Type | Description |
---|---|
System. |
Path
Gets the path.
Declaration
public string Path { get; }
Property Value
Type | Description |
---|---|
System. |
Position
Gets or sets the position in the file.
Declaration
public long Position { get; set; }
Property Value
Type | Description |
---|---|
System. |
Methods
Close()
Closes the file.
Declaration
public void Close()
Delete(String)
Deletes the specified file.
Declaration
public static bool Delete(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System. |
filePath | The file path. |
Returns
Type | Description |
---|---|
System. |
True if file is deleted, false if exception occured. |
Exists()
Returns a boolean value indicating whether the file exists.
Declaration
public bool Exists()
Returns
Type | Description |
---|---|
System. |
Flush()
Flushes the file contents.
Declaration
public bool Flush()
Returns
Type | Description |
---|---|
System. |
Open(FileStreamAccess)
Opens the file.
Declaration
public void Open(FileStreamAccess access)
Parameters
Type | Name | Description |
---|---|---|
File |
access | The access requirement. |
Read(Byte[], Int32, Int32)
Reads data from the file.
Declaration
public int Read(byte[] data, int index, int length)
Parameters
Type | Name | Description |
---|---|---|
System. |
data | The buffer to fill with data from the file. |
System. |
index | The index at which to start writing. |
System. |
length | The maximum number of bytes to read. |
Returns
Type | Description |
---|---|
System. |
The number of bytes read from the file. |
Write(Byte[], Int32, Int32)
Writes data to the file.
Declaration
public bool Write(byte[] data, int index, int length)
Parameters
Type | Name | Description |
---|---|---|
System. |
data | The data to write to the file. |
System. |
index | The index at which to start reading. |
System. |
length | The number of bytes to write. |
Returns
Type | Description |
---|---|
System. |
|
WriteTo(Int32, Byte[], Int32, Int32)
Writes data to the file.
Declaration
public bool WriteTo(int location, byte[] data, int index, int length)
Parameters
Type | Name | Description |
---|---|---|
System. |
location | The location to write to. |
System. |
data | The data to write to the file. |
System. |
index | The index at which to start reading. |
System. |
length | The number of bytes to write. |
Returns
Type | Description |
---|---|
System. |
|