using System; using System.Collections.Generic; using System.Text; namespace Capnp.Rpc { /// /// Provides extension methods for installing midlayers to and ./>. /// public static class MidlayerExtensions { /// /// Enables stream buffering on the given object. Stream buffering reduces the number of I/O operations, /// hence may cause a significant performance boost. /// /// or /// Buffer size (bytes). You should choose it according to the maximum expected raw capnp frame size public static void AddBuffering(this ISupportsMidlayers obj, int bufferSize) { obj.InjectMidlayer(s => new Util.DuplexBufferedStream(s, bufferSize)); } /// /// Enables stream buffering on the given object. Stream buffering reduces the number of I/O operations, /// hence may cause a significant performance boost. Some default buffer size will be chosen. /// /// or public static void AddBuffering(this ISupportsMidlayers obj) { obj.InjectMidlayer(s => new Util.DuplexBufferedStream(s)); } } }