C# Class GSF.IO.FileStructure.Media.CustomFileStream

A functional wrapper around a FileStream specific to how the TransactionalFileStructure uses the FileStream.
Inheritance: IDisposable
Afficher le fichier Open project: GridProtectionAlliance/openHistorian Class Usage Examples

Méthodes publiques

Méthode Description
ChangeExtension ( string extension, bool isReadOnly, bool isSharingEnabled ) : void

Changes the extension of the current file.

ChangeShareMode ( bool isReadOnly, bool isSharingEnabled ) : void

Reopens the file with different permissions.

CreateFile ( string fileName, int ioBlockSize, int fileStructureBlockSize ) : CustomFileStream

Creates a file with the supplied name

Dispose ( ) : void

Releases all the resources used by the CustomFileStream object.

FlushFileBuffers ( ) : void

Flushes any temporary data to the disk. This also calls WindowsAPI function to have the OS flush to the disk.

OpenFile ( string fileName, int ioBlockSize, int &fileStructureBlockSize, bool isReadOnly, bool isSharingEnabled ) : CustomFileStream

Opens a file

Read ( long position, IntPtr locationToCopyData ) : void

Reads an entire page at the provided location. Also computes the checksum information.

ReadRaw ( long position, byte buffer, int length ) : int

Reads data from the disk

Write ( long currentEndOfCommitPosition, MemoryPoolStreamCore stream, long length, bool waitForWriteToDisk ) : void

Writes all of the dirty blocks passed onto the disk subsystem. Also computes the checksum for the data.

WriteRaw ( long position, byte buffer, int length ) : void

Writes data to the disk

Private Methods

Méthode Description
CustomFileStream ( ) : System

Creates a resource list that everyone shares.

CustomFileStream ( FileStream stream, int ioSize, int fileStructureBlockSize, string fileName, bool isReadOnly, bool isSharingEnabled ) : System

Creates a new CustomFileStream

Method Details

ChangeExtension() public méthode

Changes the extension of the current file.
public ChangeExtension ( string extension, bool isReadOnly, bool isSharingEnabled ) : void
extension string the new extension
isReadOnly bool If the file should be reopened as readonly
isSharingEnabled bool If the file should share read privileges.
Résultat void

ChangeShareMode() public méthode

Reopens the file with different permissions.
public ChangeShareMode ( bool isReadOnly, bool isSharingEnabled ) : void
isReadOnly bool If the file should be reopened as readonly
isSharingEnabled bool If the file should share read privileges.
Résultat void

CreateFile() public static méthode

Creates a file with the supplied name
public static CreateFile ( string fileName, int ioBlockSize, int fileStructureBlockSize ) : CustomFileStream
fileName string the name of the file
ioBlockSize int the number of bytes to do all io with
fileStructureBlockSize int the number of bytes in the file structure so checksums can be properly computed.
Résultat CustomFileStream

Dispose() public méthode

Releases all the resources used by the CustomFileStream object.
public Dispose ( ) : void
Résultat void

FlushFileBuffers() public méthode

Flushes any temporary data to the disk. This also calls WindowsAPI function to have the OS flush to the disk.
public FlushFileBuffers ( ) : void
Résultat void

OpenFile() public static méthode

Opens a file
public static OpenFile ( string fileName, int ioBlockSize, int &fileStructureBlockSize, bool isReadOnly, bool isSharingEnabled ) : CustomFileStream
fileName string the name of the file.
ioBlockSize int the number of bytes to do all of the io
fileStructureBlockSize int The number of bytes in the file structure
isReadOnly bool if the file should be opened in read only
isSharingEnabled bool if the file should be opened with read sharing permissions.
Résultat CustomFileStream

Read() public méthode

Reads an entire page at the provided location. Also computes the checksum information.
public Read ( long position, IntPtr locationToCopyData ) : void
position long The stream position. May be any position inside the desired block
locationToCopyData System.IntPtr The place where to write the data to.
Résultat void

ReadRaw() public méthode

Reads data from the disk
public ReadRaw ( long position, byte buffer, int length ) : int
position long The starting position
buffer byte the byte buffer of data to read
length int the number of bytes to read
Résultat int

Write() public méthode

Writes all of the dirty blocks passed onto the disk subsystem. Also computes the checksum for the data.
public Write ( long currentEndOfCommitPosition, MemoryPoolStreamCore stream, long length, bool waitForWriteToDisk ) : void
currentEndOfCommitPosition long the last valid byte of the file system where this data will be appended to.
stream GSF.IO.Unmanaged.MemoryPoolStreamCore the source of the data to dump to the disk
length long The number by bytes to write to the file system.
waitForWriteToDisk bool True to wait for a complete commit to disk before returning from this function.
Résultat void

WriteRaw() public méthode

Writes data to the disk
public WriteRaw ( long position, byte buffer, int length ) : void
position long The starting position
buffer byte the byte buffer of data to write
length int the number of bytes to write
Résultat void