complete-reference-vb_net_55
complete-reference-vb_net_55
SeekOrigin class.
Disk files always support random access. At the time of construction, the CanSeek property is set to true or
false depending on the underlying file type. Specifically, if the underlying file type is FILE_TYPE_DISK, as
defined in winbase.h, the CanSeek property is true. Otherwise, the CanSeek property is false.
Member Purpose
CanRead (p) Retrieves a value indicating whether the current stream supports reading
CanSeek (p) Retrieves a value indicating whether the current stream supports seeking
CanWrite (p) Retrieves a value indicating whether the current stream supports writing
Handle (p) Retrieves the operating system file handle for the file that the current FileStream
object encapsulates
IsAsync (p) Retrieves a value indicating whether the FileStream was opened asynchronously
or synchronously
Length (p) Retrieves the length, in bytes, of the stream
Name (p) Retrieves the name of the FileStream that was passed to the constructor
Position (p) Retrieves or changes the current position of this stream
BeginRead Begins an asynchronous read
BeginWrite Begins an asynchronous write
Close Closes the file and releases any resources associated with the current file stream
EndRead Waits for the pending asynchronous read to complete
EndWrite Ends an asynchronous write, blocking until the I/O operation has completed
Flush Clears all buffers for this stream and causes any buffered data to be written to the
underlying device
Lock Prevents access by other processes to all or part of a file
Read Reads a block of bytes from the stream and writes the data in a given buffer
ReadByte Reads a byte from the file and advances the read position one byte
Seek Changes the current position of this stream to the given value
SetLength Changes the length of this stream to the given value
ToString Returns a String that represents the current Object
Unlock Allows access by other processes to all or part of a file that was previously locked
Write Overridden. Writes a block of bytes to this stream using data from a buffer.
WriteByte Overridden. Writes a byte to the current position in the file stream
BeginRead, BeginWrite
When you get ready to open a file object using FileStream, you need to specify either synchronous or
asynchronous mode. The read and write methods support both modes but, depending on your data and the
algorithm, the modes provide significant performance consequences for the synchronous methods (Read and
Write) and the asynchronous methods (BeginRead and BeginWrite).
539