/// <summary> /// Constructs a new <see cref="BufferSegment"/> structure. /// </summary> /// <param name="owner">The owner of this segment.</param> /// <param name="origin">The origin buffer.</param> /// <param name="offset">The starting position.</param> /// <param name="length">The number of bytes.</param> /// <param name="handle">The offset in the original array.</param> internal static BufferSegment Acquire(BufferProvider owner, byte[] origin, int offset, int length, int handle) { var segment = SegmentPool.Acquire(); segment.Owner = owner; segment.Array = origin; segment.Offset = offset; segment.Length = length; segment.Handle = handle; #if TRACE_BUFFERSEGMENT segment.AcquiredAt = Environment.StackTrace; segment.ReleasedAt = String.Empty; #endif return(segment); }
/// <summary> /// Acquires a new MQTT packet from the pool. /// </summary> /// <returns></returns> public static MqttDisconnectPacket Acquire() { return(Pool.Acquire()); }
/// <summary> /// Acquires a new MQTT packet from the pool. /// </summary> /// <returns></returns> public static MqttSubscribePacket Acquire() { return(Pool.Acquire()); }
/// <summary> /// Acquires a new MQTT packet from the pool. /// </summary> /// <returns></returns> public static MqttPubackPacket Acquire() { return(Pool.Acquire()); }
/// <summary> /// Acquires a new MQTT packet from the pool. /// </summary> /// <returns></returns> public static MqttPingReqPacket Acquire() { return(Pool.Acquire()); }
/// <summary> /// Acquires a compressor. /// </summary> /// <returns>Returns a Snappy instance.</returns> public static Snappy Acquire() { return(Compressors.Acquire()); }