System.IO.FileStream: Method Members

The methods of System.IO.FileStream are listed below. For a list of all members, see the FileStream Members list.

See Also: Inherited members from System.IO.Stream

Public Methods

override
BeginRead(byte[], int, int, AsyncCallback, object) : IAsyncResult

Begins an asynchronous read operation. (Consider using FileStream.ReadAsync(Byte[], int, int, System.Threading.CancellationToken) instead; see the Remarks section.)

override
BeginWrite(byte[], int, int, AsyncCallback, object) : IAsyncResult

Begins an asynchronous write operation. (Consider using FileStream.WriteAsync(Byte[], int, int, System.Threading.CancellationToken) instead; see the Remarks section.)

override
Close()
Closes the file and releases any resources associated with the current file stream.
override
EndRead(IAsyncResult) : int

Waits for the pending asynchronous read operation to complete. (Consider using FileStream.ReadAsync(Byte[], int, int, System.Threading.CancellationToken) instead; see the Remarks section.)

override
EndWrite(IAsyncResult)

Ends an asynchronous write operation and blocks until the I/O operation is complete. (Consider using FileStream.WriteAsync(Byte[], int, int, System.Threading.CancellationToken) instead; see the Remarks section.)

Finalize()

Ensures that resources are freed and other cleanup operations are performed when the garbage collector reclaims the FileStream.

override
Flush()

Clears buffers for this stream and causes any buffered data to be written to the file.

Flush(bool)

Clears buffers for this stream and causes any buffered data to be written to the file, and also clears all intermediate file buffers.

override
FlushAsync(System.Threading.CancellationToken) : System.Threading.Tasks.Task

Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.

GetAccessControl() : System.Security.AccessControl.FileSecurity

Gets a System.Security.AccessControl.FileSecurity object that encapsulates the access control list (ACL) entries for the file described by the current System.IO.FileStream object.

Lock(long, long)

Prevents other processes from reading from or writing to the System.IO.FileStream.

override
Read(byte[], int, int) : int

Reads a block of bytes from the stream and writes the data in a given buffer.

override
ReadAsync(byte[], int, int, System.Threading.CancellationToken) : System.Threading.Tasks.Task<int>

Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.

override
ReadByte() : int

Reads a byte from the file and advances the read position one byte.

override
Seek(long, SeekOrigin) : long

Sets the current position of this stream to the given value.

SetAccessControl(System.Security.AccessControl.FileSecurity)

Applies access control list (ACL) entries described by a System.Security.AccessControl.FileSecurity object to the file described by the current System.IO.FileStream object.

override
SetLength(long)

Sets the length of this stream to the given value.

Unlock(long, long)

Allows access by other processes to all or part of a file that was previously locked.

override
Write(byte[], int, int)

Writes a block of bytes to the file stream.

override
WriteAsync(byte[], int, int, System.Threading.CancellationToken) : System.Threading.Tasks.Task

Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

override
WriteByte(byte)

Writes a byte to the current position in the file stream.

Protected Methods

override
Dispose(bool)

Releases the unmanaged resources used by the System.IO.FileStream and optionally releases the managed resources.