本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例7: writeFloatLE
import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
public static void writeFloatLE(ByteBuf buf, float value) {
buf.writeIntLE(Float.floatToRawIntBits(value));
}
示例8: writeNumTags
import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
private static void writeNumTags(RtMessage msg, ByteBuf buf) {
buf.writeIntLE(msg.numTags());
}