/// <exception cref="System.IO.IOException" />
 public bool Read(Stream channel, long position, ByteBuffer buffer)
 {
     buffer.Position = 0;
     var originalPos = channel.Position;
     channel.Position = position;
     var data = new byte[buffer.Length];
     var bytesRead = channel.Read(data);
     buffer.Clear();
     buffer.Write(data);
     channel.Position = originalPos;
     if (bytesRead < Size)
         return false;
     buffer.Position = 0;
     _height = (uint) buffer.GetInt();
     buffer.Get(_chainWork);
     buffer.Get(_blockHeader);
     return true;
 }
 public void Dispose()
 {
     if (_channel != null)
     {
         _channel.Dispose();
         _channel = null;
     }
     if (_buf != null)
     {
         _buf.Dispose();
         _buf = null;
     }
 }