DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Public Attributes | Properties | Private Member Functions | Private Attributes | List of all members
Deveel.Data.Store.LocalFile Class Reference
Inheritance diagram for Deveel.Data.Store.LocalFile:
Deveel.Data.Store.IFile

Public Member Functions

 LocalFile (string fileName, bool readOnly)
 
void Dispose ()
 
long Seek (long offset, SeekOrigin origin)
 
void SetLength (long value)
 
int Read (byte[] buffer, int offset, int length)
 
void Write (byte[] buffer, int offset, int length)
 
void Flush (bool writeThrough)
 
void Close ()
 
void Delete ()
 

Public Attributes

const int BufferSize = 1024 * 2
 

Properties

string FileName [get, private set]
 
bool IsReadOnly [get, private set]
 
long Position [get]
 
long Length [get]
 
bool Exists [get]
 
- Properties inherited from Deveel.Data.Store.IFile
string FileName [get]
 
bool IsReadOnly [get]
 
long Position [get]
 
long Length [get]
 
bool Exists [get]
 

Private Member Functions

void Dispose (bool disposing)
 

Private Attributes

System.IO.FileStream fileStream
 

Detailed Description

Definition at line 21 of file LocalFile.cs.

Constructor & Destructor Documentation

Deveel.Data.Store.LocalFile.LocalFile ( string  fileName,
bool  readOnly 
)
inline

Definition at line 26 of file LocalFile.cs.

26  {
27  if (String.IsNullOrEmpty(fileName))
28  throw new ArgumentNullException("fileName");
29 
30  var fileMode = readOnly ? FileMode.Open : FileMode.OpenOrCreate;
31  var fileAccess = readOnly ? FileAccess.Read : FileAccess.ReadWrite;
32  // TODO: using the enrypted option uses the user's encryption: should we use a different system?
33  var options = FileOptions.WriteThrough | FileOptions.Encrypted;
34  fileStream = new System.IO.FileStream(fileName, fileMode, fileAccess, FileShare.None, BufferSize, options);
35  }
A long string in the system.
System.IO.FileStream fileStream
Definition: LocalFile.cs:22

Member Function Documentation

void Deveel.Data.Store.LocalFile.Close ( )
inline

Implements Deveel.Data.Store.IFile.

Definition at line 87 of file LocalFile.cs.

87  {
88  fileStream.Close();
89  }
System.IO.FileStream fileStream
Definition: LocalFile.cs:22
void Deveel.Data.Store.LocalFile.Delete ( )
inline

Implements Deveel.Data.Store.IFile.

Definition at line 91 of file LocalFile.cs.

91  {
92  try {
93  File.Delete(FileName);
94  } finally {
95  fileStream = null;
96  }
97 
98  }
System.IO.FileStream fileStream
Definition: LocalFile.cs:22
void Deveel.Data.Store.LocalFile.Dispose ( )
inline

Definition at line 37 of file LocalFile.cs.

37  {
38  Dispose(true);
39  GC.SuppressFinalize(this);
40  }
void Deveel.Data.Store.LocalFile.Dispose ( bool  disposing)
inlineprivate

Definition at line 42 of file LocalFile.cs.

42  {
43  if (disposing) {
44  if (fileStream != null)
46  }
47 
48  fileStream = null;
49  }
System.IO.FileStream fileStream
Definition: LocalFile.cs:22
override void Dispose(bool disposing)
Definition: FileStream.cs:72
void Deveel.Data.Store.LocalFile.Flush ( bool  writeThrough)
inline

Implements Deveel.Data.Store.IFile.

Definition at line 83 of file LocalFile.cs.

83  {
84  fileStream.Flush();
85  }
System.IO.FileStream fileStream
Definition: LocalFile.cs:22
int Deveel.Data.Store.LocalFile.Read ( byte[]  buffer,
int  offset,
int  length 
)
inline

Implements Deveel.Data.Store.IFile.

Definition at line 75 of file LocalFile.cs.

75  {
76  return fileStream.Read(buffer, offset, length);
77  }
System.IO.FileStream fileStream
Definition: LocalFile.cs:22
override int Read(byte[] buffer, int offset, int count)
Definition: FileStream.cs:43
long Deveel.Data.Store.LocalFile.Seek ( long  offset,
SeekOrigin  origin 
)
inline

Implements Deveel.Data.Store.IFile.

Definition at line 67 of file LocalFile.cs.

67  {
68  return fileStream.Seek(offset, origin);
69  }
System.IO.FileStream fileStream
Definition: LocalFile.cs:22
override long Seek(long offset, SeekOrigin origin)
Definition: FileStream.cs:35
void Deveel.Data.Store.LocalFile.SetLength ( long  value)
inline

Implements Deveel.Data.Store.IFile.

Definition at line 71 of file LocalFile.cs.

71  {
72  fileStream.SetLength(value);
73  }
System.IO.FileStream fileStream
Definition: LocalFile.cs:22
override void SetLength(long value)
Definition: FileStream.cs:39
void Deveel.Data.Store.LocalFile.Write ( byte[]  buffer,
int  offset,
int  length 
)
inline

Implements Deveel.Data.Store.IFile.

Definition at line 79 of file LocalFile.cs.

79  {
80  fileStream.Write(buffer, offset, length);
81  }
override void Write(byte[] buffer, int offset, int count)
Definition: FileStream.cs:47
System.IO.FileStream fileStream
Definition: LocalFile.cs:22

Member Data Documentation

const int Deveel.Data.Store.LocalFile.BufferSize = 1024 * 2

Definition at line 24 of file LocalFile.cs.

System.IO.FileStream Deveel.Data.Store.LocalFile.fileStream
private

Definition at line 22 of file LocalFile.cs.

Property Documentation

bool Deveel.Data.Store.LocalFile.Exists
get

Definition at line 63 of file LocalFile.cs.

string Deveel.Data.Store.LocalFile.FileName
getprivate set

Definition at line 51 of file LocalFile.cs.

bool Deveel.Data.Store.LocalFile.IsReadOnly
getprivate set

Definition at line 53 of file LocalFile.cs.

long Deveel.Data.Store.LocalFile.Length
get

Definition at line 59 of file LocalFile.cs.

long Deveel.Data.Store.LocalFile.Position
get

Definition at line 55 of file LocalFile.cs.


The documentation for this class was generated from the following file: