Java Code Examples for io.netty.buffer.ByteBuf.writeShortLE()

The following are Jave code examples for showing how to use writeShortLE() of the io.netty.buffer.ByteBuf class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: JungleTree   File: ResourcePackResponseCodec.java   Source Code and License Vote up 5 votes
@Override
public void encode(Packet msg, ByteBuf buf) {
    ResourcePackResponsePacket packet = (ResourcePackResponsePacket) msg;
    buf.writeByte(packet.getStatus().getOrdinal());

    String[] packs = packet.getPacksToDownload();
    buf.writeShortLE((short) packs.length);
    for (String pack : packs) {
        ByteBufUtils.writeString(buf, pack);
    }
}
 
Example 2
Project: kcp-netty   File: Kcp.java   Source Code and License Vote up 5 votes
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;
}
 
Example 3
Project: ProtocolSupportPocketStuff   File: TransferPacket.java   Source Code and License Vote up 4 votes
@Override
public void toData(Connection connection, ByteBuf serializer) {
	StringSerializer.writeString(serializer, connection.getVersion(), address);
	serializer.writeShortLE(port);
}