io.netty.buffer.ByteBuf.writeLong()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(176)

本文整理了Java中io.netty.buffer.ByteBuf.writeLong()方法的一些代码示例,展示了ByteBuf.writeLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.writeLong()方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:writeLong

ByteBuf.writeLong介绍

[英]Sets the specified 64-bit long integer at the current writerIndex and increases the writerIndex by 8in this buffer.
[中]在当前writerIndex处设置指定的64位长整数,并在此缓冲区中将writerIndex增加8。

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
public void write(final ByteBuf buffer) {
  buffer.writeByte(DataConstants.LONG);
  buffer.writeLong(val);
}

代码示例来源:origin: qunarcorp/qmq

@Override
  public void writeBody(ByteBuf out) {
    out.writeInt(size);
    out.writeLong(startOffset);
    out.writeLong(segmentBaseOffset);
    if (buffer != null) {
      out.writeBytes(buffer);
    }
  }
}

代码示例来源:origin: qunarcorp/qmq

@Override
  public void writeBody(ByteBuf out) {
    out.writeInt(0);
    out.writeLong(startOffset);
  }
}

代码示例来源:origin: fengjiachun/Jupiter

@Override
  protected void encode(ChannelHandlerContext ctx, Acknowledge ack, ByteBuf out) throws Exception {
    out.writeShort(JProtocolHeader.MAGIC)
        .writeByte(JProtocolHeader.ACK)
        .writeByte(0)
        .writeLong(ack.sequence())
        .writeInt(0);
  }
}

代码示例来源:origin: qunarcorp/qmq

flag = Flags.setTags(flag, hasTags(tags));
out.writeByte(flag);
out.writeLong(message.getCreatedTime().getTime());
if (Flags.isDelay(flag)) {
  out.writeLong(message.getScheduleReceiveTime().getTime());
} else {
  out.writeLong(System.currentTimeMillis());
out.writeInt(bodyLen);
out.writeLong(messageCrc(out, messageStart, messageLength));

代码示例来源:origin: wildfly/wildfly

public void encodeHeadersAndProperties(final ByteBuf buffer) {
 checkProperties();
 messageIDPosition = buffer.writerIndex();
 buffer.writeLong(messageID);
 SimpleString.writeNullableSimpleString(buffer, address);
 if (userID == null) {
   buffer.writeByte(DataConstants.NULL);
 } else {
   buffer.writeByte(DataConstants.NOT_NULL);
   buffer.writeBytes(userID.asBytes());
 }
 buffer.writeByte(type);
 buffer.writeBoolean(durable);
 buffer.writeLong(expiration);
 buffer.writeLong(timestamp);
 buffer.writeByte(priority);
 properties.encode(buffer);
}

代码示例来源:origin: qunarcorp/qmq

@Override
public void writeBody(ByteBuf out) {
  out.writeLong(response.getTimestamp());
  PayloadHolderUtils.writeString(response.getSubject(), out);
  PayloadHolderUtils.writeString(response.getConsumerGroup(), out);
  out.writeByte(response.getOnOfflineState().code());
  out.writeByte(response.getClientTypeCode());
  out.writeShort(response.getBrokerCluster().getBrokerGroups().size());
  writeBrokerCluster(out);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public PacketProgressBar( final int shortID, final long value )
{
  this.id = (short) shortID;
  this.value = value;
  final ByteBuf data = Unpooled.buffer();
  data.writeInt( this.getPacketID() );
  data.writeShort( shortID );
  data.writeLong( value );
  this.configureWrite( data );
}

代码示例来源:origin: qunarcorp/qmq

@Override
  public void writeBody(ByteBuf out) {
    out.writeShort((short) result.size());
    for (Long count : result) {
      out.writeLong(count);
    }
  }
}

代码示例来源:origin: fengjiachun/Jupiter

@Override
  protected void encode(ChannelHandlerContext ctx, Acknowledge ack, ByteBuf out) throws Exception {
    out.writeShort(JProtocolHeader.MAGIC)
        .writeByte(JProtocolHeader.ACK)
        .writeByte(0)
        .writeLong(ack.sequence())
        .writeInt(0);
  }
}

代码示例来源:origin: qunarcorp/qmq

@Override
  public void writeBody(ByteBuf out) {
    out.writeInt(size);
    out.writeLong(startOffset);
    if (buffer != null) {
      out.writeBytes(buffer);
    }
  }
}

代码示例来源:origin: apache/drill

&& (isEqualityFn || encodingType.startsWith("U"))) {
 bb = newByteBuf(4, encodingType.endsWith("_BE"));
 bb.writeInt(((IntExpression) valueArg).getInt());
  && (isEqualityFn || encodingType.startsWith("U"))) {
 bb = newByteBuf(8, encodingType.endsWith("_BE"));
 bb.writeLong(((LongExpression) valueArg).getLong());
if (valueArg instanceof TimeExpression) {
 bb = newByteBuf(8, encodingType.endsWith("_BE"));
 bb.writeLong(((TimeExpression) valueArg).getTime());
if (valueArg instanceof DateExpression) {
 bb = newByteBuf(8, encodingType.endsWith("_BE"));
 bb.writeLong(((DateExpression) valueArg).getDate());
if (valueArg instanceof BooleanExpression) {
 bb = newByteBuf(1, false /* does not matter */);
 bb.writeByte(((BooleanExpression) valueArg).getBoolean() ? 1 : 0);

代码示例来源:origin: alibaba/Sentinel

@Override
  public void writeTo(FlowRequestData entity, ByteBuf target) {
    target.writeLong(entity.getFlowId());
    target.writeInt(entity.getCount());
    target.writeBoolean(entity.isPriority());
  }
}

代码示例来源:origin: GlowstoneMC/Glowstone

buf.writeByte(data.getBitsPerValue()); // Bit per value -> varies
if (palette == null) {
  ByteBufUtils.writeVarInt(buf, 0); // Palette size -> 0 -> Use the global palette
    .byteSize() : 0));
for (long value : backing) {
  buf.writeLong(value);

代码示例来源:origin: sinkillerj/ProjectE

@Override
public void toBytes(ByteBuf buf)
{
  buf.writeByte(windowId);
  buf.writeShort(propId);
  buf.writeLong(propVal);
}

代码示例来源:origin: SleepyTrousers/EnderIO

public void writeToBuf(@Nonnull ByteBuf buf) {
 buf.writeLong(energyStored);
 buf.writeLong(maxEnergyStored);
 buf.writeInt(maxIO);
 buf.writeInt(maxInput);
 buf.writeInt(maxOutput);
 buf.writeShort(inputMode.ordinal());
 buf.writeShort(outputMode.ordinal());
 buf.writeFloat(averageInput);
 buf.writeFloat(averageOutput);
}

代码示例来源:origin: wildfly/wildfly

@Override
public void write(final ByteBuf buffer) {
  buffer.writeByte(DataConstants.DOUBLE);
  buffer.writeLong(Double.doubleToLongBits(val));
}

代码示例来源:origin: traccar/traccar

private static void sendResponse(Channel channel, SocketAddress remoteAddress, long rawId, int index) {
  if (channel != null) {
    ByteBuf response = Unpooled.buffer(12);
    response.writeShort(0xfe02);
    response.writeLong(rawId);
    response.writeShort(index);
    channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
  }
}

代码示例来源:origin: netty/netty

"length does not fit into a byte: " + length);
  out.add(ctx.alloc().buffer(1).order(byteOrder).writeByte((byte) length));
  break;
case 2:
        "length does not fit into a short integer: " + length);
  out.add(ctx.alloc().buffer(2).order(byteOrder).writeShort((short) length));
  break;
case 3:
  break;
case 4:
  out.add(ctx.alloc().buffer(4).order(byteOrder).writeInt(length));
  break;
case 8:
  out.add(ctx.alloc().buffer(8).order(byteOrder).writeLong(length));
  break;
default:

代码示例来源:origin: wildfly/wildfly

long c = req.content().readLong();
  ByteBuf input = Unpooled.buffer(16);
  input.writeInt(a);
  input.writeInt(b);
  input.writeLong(c);
  res.content().writeBytes(WebSocketUtil.md5(input.array()));
} else {

相关文章

ByteBuf类方法