Beispiel #1
0
 public void Set(Stream source)
 {
     _bfs.Lock();
     try
     {
         int handle = Handle;
         using (Stream target = _bfs.RewriteFile(handle).BaseStream)
         {
             SetStream(source, target);
         }
         _bfs.Flush();
     }
     finally
     {
         _bfs.UnLock();
     }
 }
Beispiel #2
0
 public override void Close()
 {
     if (_dirty)
     {
         _bfs.Lock();
         int handle = _handle;
         try
         {
             using (Stream stream = _bfs.RewriteFile(handle).BaseStream)
             {
                 WriteTo(stream);
             }
             _bfs.Flush();
         }
         finally
         {
             _bfs.UnLock();
         }
     }
     base.Close();
 }
Beispiel #3
0
 public BlobFSMemoryStream(int handle, BlobFileSystem bfs)
     : base(1024)
 {
     _handle = handle;
     _bfs    = bfs;
     bfs.Lock();
     try
     {
         CopyStream(this, bfs.GetRawStream(handle), bfs.GetRawBytes());
     }
     catch
     {
         SetLength(0);
         bfs.RewriteFile(handle);
         bfs.Flush();
     }
     finally
     {
         bfs.UnLock();
     }
     base.Position = 0;
     _dirty        = false;
 }