.Net library consisting of three classes for simplified
asynchronous I/O (AsyncStream), using
alternate data streams (AlternateStreams), and
efficient stream peeking and seeking (BetterBufferedStream).
BetterStreams can easily improve the
performance of new or existing applications, sometimes dramatically, with as little as a single-line change to the code.
AsyncStream
wraps an existing
stream and provides
asynchronous I/O via the standard Read(), ReadByte(), Write(), and WriteByte() methods; if called on the wrapped
stream directly these would require waiting for
I/O to the underlying device (such as a disk) but the AsyncStream asynchronously and automatically fills or flushes its internal
buffer from or to the wrapped
stream using a
background thread and will never block so long as sufficient bytes are available in the buffer.
Even if your application logic is already built around synchronous I/O, making it
asynchronous typically requires nothing more than wrapping the original
stream in an AsyncStream.
AsyncStreams also provide elegant exception handling, properties for fine-tuning
performance and behavior when desired, and, like BetterBufferedStreams,
efficient seeking.
AlternateStreams enables you to read, write, delete, create and list
alternate data streams (ADS) in an NTFS file.
Under NTFS, each
file has a "main" unnamed
stream (this is the one the Framework's
file I/O classes manipulate) as well as zero or more "alternate" named streams; for example, Internet Explorer uses an
alternate stream named "Zone.Identifier" to record which security zone a downloaded
file came from.
Aside from conveniently storing metadata, they can also be used to create "compound storage" for application data; instead of, for example, sequentially serializing ten objects to the "main" fie
stream (requiring the entire
file to be rewritten if any but the last object changes) each object can be serialized to its own, individually modifiable
alternate stream.
To link back to this page, please copy the code below and insert into your page and save the image button on your server.