当前位置: 首页>>代码示例>>C#>>正文


C# ByteBuffer.PutLong方法代码示例

本文整理汇总了C#中ByteBuffer.PutLong方法的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer.PutLong方法的具体用法?C# ByteBuffer.PutLong怎么用?C# ByteBuffer.PutLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ByteBuffer的用法示例。


在下文中一共展示了ByteBuffer.PutLong方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Encode

        /// <summary>
        /// Encodes the supplied <see cref="IRecordedData"/> into the supplied <see cref="ByteBuffer"/>.
        /// </summary>
        /// <param name="data">The data to encode.</param>
        /// <param name="buffer">The target <see cref="ByteBuffer"/> to write to.</param>
        /// <returns>The number of bytes written.</returns>
        public int Encode(IRecordedData data, ByteBuffer buffer)
        {
            int initialPosition = buffer.Position;
            buffer.PutInt(data.Cookie);
            int payloadLengthPosition = buffer.Position;
            buffer.PutInt(0); // Placeholder for payload length in bytes.
            buffer.PutInt(data.NormalizingIndexOffset);
            buffer.PutInt(data.NumberOfSignificantValueDigits);
            buffer.PutLong(data.LowestDiscernibleValue);
            buffer.PutLong(data.HighestTrackableValue);
            buffer.PutDouble(data.IntegerToDoubleValueConversionRatio);

            var payloadLength = FillBufferFromCountsArray(buffer, data);
            buffer.PutInt(payloadLengthPosition, payloadLength);

            var bytesWritten = buffer.Position - initialPosition;
            return bytesWritten;
        }
开发者ID:qooroo,项目名称:HdrHistogram.NET,代码行数:24,代码来源:HistogramEncoderV2.cs

示例2: WriteTo

        public override void WriteTo(ByteBuffer buffer)
        {
            buffer.PutShort(this.VersionId);
            buffer.PutInt(this.CorrelationId);
            ApiUtils.WriteShortString(buffer, this.ClientId);
            buffer.PutInt(this.ReplicaId);

            buffer.PutInt(this.requestInfoGroupedByTopic.Value.Count);
            foreach (var topicAndPartitionInfos in this.requestInfoGroupedByTopic.Value)
            {
                var topic = topicAndPartitionInfos.Key;
                var partitionInfos = topicAndPartitionInfos.Value;
                ApiUtils.WriteShortString(buffer, topic);
                buffer.PutInt(partitionInfos.Count); // partition count
                foreach (var pi in partitionInfos)
                {
                    var partition = pi.Key.Partiton;
                    var partitionInfo = pi.Value;
                    buffer.PutInt(partition);
                    buffer.PutLong(partitionInfo.Time);
                    buffer.PutInt(partitionInfo.MaxNumOffsets);
                }
            }
        }
开发者ID:CMTelecom,项目名称:kafka-net,代码行数:24,代码来源:OffsetRequest.cs

示例3: WriteTo

 public override void WriteTo(ByteBuffer buffer)
 {
     buffer.PutShort(this.VersionId);
     buffer.PutInt(this.CorrelationId);
     ApiUtils.WriteShortString(buffer, this.ClientId);
     buffer.PutInt(this.ReplicaId);
     buffer.PutInt(this.MaxWait);
     buffer.PutInt(this.MinBytes);
     buffer.PutInt(this.requestInfoGroupedByTopic.Value.Count); // topic count
     foreach (var kvp in this.requestInfoGroupedByTopic.Value)
     {
         var topic = kvp.Key;
         var partitionFetchInfos = kvp.Value;
         ApiUtils.WriteShortString(buffer, topic);
         buffer.PutInt(partitionFetchInfos.Count); // partition count
         foreach (var pfi in partitionFetchInfos)
         {
             buffer.PutInt(pfi.Key.Partiton);
             buffer.PutLong(pfi.Value.Offset);
             buffer.PutInt(pfi.Value.FetchSize);
         }
     }
 }
开发者ID:ajperrins,项目名称:kafka-net,代码行数:23,代码来源:FetchRequest.cs

示例4: WriteTo

        public override void WriteTo(ByteBuffer buffer)
        {
            var groupedStatus = this.statusGroupedByTopic.Value;
            buffer.PutInt(this.CorrelationId);
            buffer.PutInt(groupedStatus.Count); // topic count

            foreach (var topicStatus in groupedStatus)
            {
                var topic = topicStatus.Key;
                var errorsAndOffsets = topicStatus.Value;
                ApiUtils.WriteShortString(buffer, topic);
                buffer.PutInt(errorsAndOffsets.Count); // partition count
                foreach (var kvp in errorsAndOffsets)
                {
                    buffer.PutInt(kvp.Key.Partiton);
                    buffer.PutShort(kvp.Value.Error);
                    buffer.PutLong(kvp.Value.Offset);
                }
            }
        }
开发者ID:CMTelecom,项目名称:kafka-net,代码行数:20,代码来源:ProducerResponse.cs

示例5: WriteTo

 public override void WriteTo(ByteBuffer buffer)
 {
     buffer.PutInt(CorrelationId);
     buffer.PutInt(offsetsGroupedByTopic.Value.Count); // topic count
     foreach (var kvp in offsetsGroupedByTopic.Value)
     {
         var topic = kvp.Key;
         var errorAndOffsetsMap = kvp.Value;
         ApiUtils.WriteShortString(buffer, topic);
         buffer.PutInt(errorAndOffsetsMap.Count);
         foreach (var topicPartitionAndErrorOffset in errorAndOffsetsMap)
         {
             buffer.PutInt(topicPartitionAndErrorOffset.Key.Partiton);
             buffer.PutShort(topicPartitionAndErrorOffset.Value.Error);
             buffer.PutInt(topicPartitionAndErrorOffset.Value.Offsets.Count);
             foreach (var offset in topicPartitionAndErrorOffset.Value.Offsets)
             {
                 buffer.PutLong(offset);
             }
         }
     }
 }
开发者ID:CMTelecom,项目名称:kafka-net,代码行数:22,代码来源:OffsetResponse.cs


注:本文中的ByteBuffer.PutLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。