Click or drag to resize

XsWin32FileStream Class

X#
This class is used for Shared diskaccess on Windows.
Inheritance Hierarchy
Object
  MarshalByRefObject
    Stream
      FileStream
        XsFileStream
          XsWin32FileStream

Namespace:  XSharp.IO
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.21
Syntax
 CLASS XsWin32FileStream INHERIT XsFileStream
Request Example View Source

The XsWin32FileStream type exposes the following members.

Properties
  NameDescription
Public propertyFileName
The name of the file opened in the stream.
(Inherited from XsFileStream.)
Public propertyLength
Gets the length in bytes of the stream.
(Overrides Length.)
Top
Methods
  NameDescription
Public methodFlush
Clears buffers for this stream and causes any buffered data to be written to the file.
(Overrides Flush.)
Public methodFlush(Logic)
Clears buffers for this stream and causes any buffered data to be written to the file, and also clears all intermediate file buffers.
(Overrides Flush(Logic).)
Public methodLock
Prevents other processes from reading from or writing to the FileStream.
(Overrides Lock(Int64, Int64).)
Public methodRead
Reads a block of bytes from the stream and writes the data in a given buffer.
(Overrides Read(Byte, Long, Long).)
Public methodSeek
Sets the current position of this stream to the given value.
(Overrides Seek(Int64, SeekOrigin).)
Public methodSetLength
Sets the length of this stream to the given value.
(Overrides SetLength(Int64).)
Public methodUnlock
Allows access by other processes to all or part of a file that was previously locked.
(Overrides Unlock(Int64, Int64).)
Public methodWrite
Writes a block of bytes to the file stream.
(Overrides Write(Byte, Long, Long).)
Public methodWriteByte
Writes a byte to the current position in the file stream.
(Overrides WriteByte(Byte).)
Top
Extension Methods
  NameDescription
Public Extension MethodSafeLock
Locks a region in a stream. Contains TRY CATCH mechanism.
(Defined by FileStreamExensions.)
Public Extension MethodSafeRead(Byte)Overloaded.
Read data from a stream. Assumes that the whole buffer must be read. Reads from current location.
(Defined by FileStreamExensions.)
Public Extension MethodSafeRead(Byte, Long)Overloaded.
Read data from a stream. Contains TRY CATCH mechanism. Reads from current location.
(Defined by FileStreamExensions.)
Public Extension MethodSafeRead(Byte, Long, Long)Overloaded.
Read data from a stream. Contains TRY CATCH mechanism. Reads from current location.
(Defined by FileStreamExensions.)
Public Extension MethodSafeReadAt(Int64, Byte)Overloaded.
Read data at a location in the file. Makes sure that file locations are >= 0. Assumes whole buffer must be read.
(Defined by FileStreamExensions.)
Public Extension MethodSafeReadAt(Int64, Byte, Long)Overloaded.
Read data at a location in the file. Makes sure that file locations are >= 0
(Defined by FileStreamExensions.)
Public Extension MethodSafeSetLength
Sets the length of a stream. Contains TRY CATCH mechanism.
(Defined by FileStreamExensions.)
Public Extension MethodSafeSetPos
Sets the location of a stream. Contains TRY CATCH mechanism. .
(Defined by FileStreamExensions.)
Public Extension MethodSafeUnlock
Unlocks a region in a stream. Contains TRY CATCH mechanism.
(Defined by FileStreamExensions.)
Public Extension MethodSafeWrite(Byte)Overloaded.
Write data to a stream. Contains TRY CATCH mechanism. Writes to the current location. Assumes the whole buffer must be written.
(Defined by FileStreamExensions.)
Public Extension MethodSafeWrite(Byte, Long)Overloaded.
Write data to a stream. Contains TRY CATCH mechanism. Writes to the current location.
(Defined by FileStreamExensions.)
Public Extension MethodSafeWriteAt(Int64, Byte)Overloaded.
Write data at a location in the file. Makes sure that file locations are >= 0. Assumes whole buffer must be written.
(Defined by FileStreamExensions.)
Public Extension MethodSafeWriteAt(Int64, Byte, Long)Overloaded.
Write data at a location in the file. Makes sure that file locations are >= 0.
(Defined by FileStreamExensions.)
Public Extension MethodSafeWriteByte
Write data to a stream. Contains TRY CATCH mechanism. Writes to the current location.
(Defined by FileStreamExensions.)
Top
Remarks
The class bypasses some of the default methods in the FileStraem class and directly uses calls to OS functions to make sure that changes made by other users are visible and not hidden because of caching in the .Net FileStream class.
See Also