當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。