Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class XclStream : System.IO.Stream
- {
- private System.IO.Stream _baseStream = null;
- private bool _cancelled = false;
- public XclStream(System.IO.Stream baseStream) : base()
- {
- _baseStream = baseStream;
- }
- public void Cancel()
- {
- _cancelled = true;
- }
- public override int Read(byte[] buffer, int offset, int count)
- {
- if (_cancelled == true)
- {
- throw new StreamCancelledException();
- }
- return _baseStream.Read(buffer, offset, count);
- }
- //TODO: override all other Stream methods...
- }
- public class StreamCancelledException : Exception
- {
- public StreamCancelledException() : base("Stream cancelled. Byebye, xmlreader...") { }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement