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


Java ByteBuf.writeIntLE方法代码示例

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


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

示例1: write

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void write(RakNetByteBuf out) {
    super.write(out);
    out.writeInt(protocolVersion);
    out.writeByte(edition);

    ByteBuf buf = Unpooled.buffer();
    buf.writeIntLE(chainData.length());
    buf.writeCharSequence(chainData, Charsets.UTF_8);
    buf.writeIntLE(skinData.length());
    buf.writeCharSequence(skinData, Charsets.UTF_8);

    out.writeUnsignedVarInt(buf.writerIndex());
    out.writeBytes(buf);
    buf.release();
}
 
开发者ID:MagicDroidX,项目名称:RakNetty,代码行数:17,代码来源:LoginPacket.java

示例2: encode

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void encode(Packet msg, ByteBuf buf) {
    LoginPacket message = (LoginPacket) msg;

    // TODO: Encoding
    buf.writeInt(message.getClientNetworkVersion());

    ConnectionInfo info = message.getConnectionInfo();
    byte[] chainBytes = GSON.toJson(info.getTokenChain()).getBytes(StandardCharsets.UTF_8);
    byte[] clientDataTokenBytes = info.getClientDataToken().getBytes(StandardCharsets.UTF_8);

    // Write body size
    ByteBufUtils.writeUnsignedVarInt(buf, chainBytes.length + clientDataTokenBytes.length + (LE_INT_SIZE_BYTES * 2));

    buf.writeIntLE(chainBytes.length);
    buf.writeBytes(chainBytes);

    buf.writeIntLE(clientDataTokenBytes.length);
    buf.writeBytes(clientDataTokenBytes);
}
 
开发者ID:JungleTree,项目名称:JungleTree,代码行数:21,代码来源:LoginCodec.java

示例3: writeOffsets

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
private static void writeOffsets(RtMessage msg, ByteBuf buf) {
  if (msg.numTags() < 2) {
    return;
  }

  Iterator<byte[]> iter = msg.mapping().values().iterator();
  int offsetSum = iter.next().length;

  while (iter.hasNext()) {
    buf.writeIntLE(offsetSum);
    offsetSum += iter.next().length;
  }

  checkState(offsetSum >= 0);
}
 
开发者ID:int08h,项目名称:nearenough,代码行数:16,代码来源:RtWire.java

示例4: encodeSeg

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
private static int encodeSeg(ByteBuf buf, Segment seg) {
    int offset = buf.writerIndex();

    buf.writeIntLE(seg.conv);
    buf.writeByte(seg.cmd);
    buf.writeByte(seg.frg);
    buf.writeShortLE(seg.wnd);
    buf.writeIntLE((int) seg.ts);
    buf.writeIntLE((int) seg.sn);
    buf.writeIntLE((int) seg.una);
    buf.writeIntLE(seg.data.readableBytes());

    return buf.writerIndex() - offset;
}
 
开发者ID:szhnet,项目名称:kcp-netty,代码行数:15,代码来源:Kcp.java

示例5: toData

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toData(Connection connection, ByteBuf serializer) {
	StringSerializer.writeString(serializer, ProtocolVersion.MINECRAFT_PE, packId);
	serializer.writeIntLE(chunkIdx);
	serializer.writeLongLE(StuffUtils.CHUNK_SIZE * chunkIdx);
	serializer.writeIntLE(packChunk.length);
	serializer.writeBytes(packChunk);
}
 
开发者ID:ProtocolSupport,项目名称:ProtocolSupportPocketStuff,代码行数:9,代码来源:ResourcePackChunkDataPacket.java

示例6: toData

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toData(Connection connection, ByteBuf serializer) {
	StringSerializer.writeString(serializer, ProtocolVersion.MINECRAFT_PE, pack.getPackId());
	serializer.writeIntLE(StuffUtils.CHUNK_SIZE); // max chunk size 1MB
	serializer.writeIntLE(pack.getPackSize() / StuffUtils.CHUNK_SIZE); // chunk count
	serializer.writeLongLE(pack.getPackSize()); // res pack size

	byte[] hash = pack.getSha256();

	VarNumberSerializer.writeVarInt(serializer, hash.length);
	for (byte b : hash) {
		serializer.writeByte(b);
	}
}
 
开发者ID:ProtocolSupport,项目名称:ProtocolSupportPocketStuff,代码行数:15,代码来源:ResourcePackDataInfoPacket.java

示例7: writeFloatLE

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
public static void writeFloatLE(ByteBuf buf, float value) {
    buf.writeIntLE(Float.floatToRawIntBits(value));
}
 
开发者ID:JungleTree,项目名称:JungleTree,代码行数:4,代码来源:ByteBufUtils.java

示例8: writeNumTags

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
private static void writeNumTags(RtMessage msg, ByteBuf buf) {
  buf.writeIntLE(msg.numTags());
}
 
开发者ID:int08h,项目名称:nearenough,代码行数:4,代码来源:RtWire.java


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