List of usage examples for io.netty.buffer ByteBuf writeInt
public abstract ByteBuf writeInt(int value);
From source file:com.linecorp.armeria.server.grpc.ArmeriaGrpcServerStreamTest.java
License:Apache License
private static byte[] compressionFrame(byte[] data) { ByteBuf buf = Unpooled.buffer(); buf.writeByte(0);/*from ww w .j av a 2s.com*/ buf.writeInt(data.length); buf.writeBytes(data); return ByteBufUtil.getBytes(buf); }
From source file:com.linecorp.armeria.server.grpc.ArmeriaServerCall.java
License:Apache License
private HttpData serializeTrailersAsMessage(HttpHeaders trailers) { final ByteBuf serialized = ctx.alloc().buffer(); boolean success = false; try {/*from w w w .j a va 2 s.c o m*/ serialized.writeByte(TRAILERS_FRAME_HEADER); // Skip, we'll set this after serializing the headers. serialized.writeInt(0); for (Map.Entry<AsciiString, String> trailer : trailers) { encodeHeader(trailer.getKey(), trailer.getValue(), serialized); } final int messageSize = serialized.readableBytes() - 5; serialized.setInt(1, messageSize); success = true; } finally { if (!success) { serialized.release(); } } return new ByteBufHttpData(serialized, true); }
From source file:com.lothrazar.cyclicmagic.gui.container.PacketGuiShortOverride.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { //not writeShort as the legacy vanilla system does buf.writeInt(fieldId); buf.writeInt(value);/*from w w w .j ava2s. c o m*/ }
From source file:com.lothrazar.cyclicmagic.item.enderbook.PacketDeleteWaypoint.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { buf.writeInt(slot); }
From source file:com.lothrazar.cyclicmagic.playerupgrade.PacketSyncExtendedInventory.java
License:Open Source License
@Override public void toBytes(ByteBuf buffer) { buffer.writeByte(slot); buffer.writeInt(playerId); ByteBufUtils.writeItemStack(buffer, itemStack); }
From source file:com.ltln.modules.openflow.core.protocol.ver10.OFBsnVportL2GreFlagsSerializerVer10.java
public static void writeTo(ByteBuf bb, Set<OFBsnVportL2GreFlags> set) { bb.writeInt(toWireValue(set)); }
From source file:com.ltln.modules.openflow.core.protocol.ver10.OFCapabilitiesSerializerVer10.java
public static void writeTo(ByteBuf bb, Set<OFCapabilities> set) { bb.writeInt(toWireValue(set)); }
From source file:com.ltln.modules.openflow.core.protocol.ver10.OFFlowWildcardsSerializerVer10.java
public static void writeTo(ByteBuf bb, Set<OFFlowWildcards> set) { bb.writeInt(toWireValue(set)); }
From source file:com.ltln.modules.openflow.core.protocol.ver10.OFNiciraControllerRoleSerializerVer10.java
public static void writeTo(ByteBuf bb, OFNiciraControllerRole e) { bb.writeInt(toWireValue(e)); }
From source file:com.ltln.modules.openflow.core.protocol.ver10.OFPortConfigSerializerVer10.java
public static void writeTo(ByteBuf bb, Set<OFPortConfig> set) { bb.writeInt(toWireValue(set)); }