List of usage examples for io.netty.buffer ByteBuf writeInt
public abstract ByteBuf writeInt(int value);
From source file:com.crowsofwar.avatar.common.network.packets.PacketSUseAbility.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { buf.writeInt(ability.getId()); raytrace.toBytes(buf); }
From source file:com.crowsofwar.avatar.common.network.packets.PacketSUseStatusControl.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { buf.writeInt(statusControl.id()); raytrace.toBytes(buf); }
From source file:com.crowsofwar.avatar.common.util.AvatarByteBufUtils.java
License:Open Source License
public static <T> void writeList(ByteBuf buf, List<T> list, Consumer<T> writer) { buf.writeInt(list.size()); for (T t : list) { writer.accept(t);/*from w w w . j a v a 2s.c o m*/ } }
From source file:com.crowsofwar.avatar.common.util.AvBlockPos.java
License:Open Source License
public void toBytes(ByteBuf buf) { buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); }
From source file:com.crowsofwar.gorecore.util.GoreCoreByteBufUtil.java
License:Open Source License
public static void writeString(ByteBuf buf, String str) { char[] chs = str.toCharArray(); buf.writeInt(chs.length); for (int i = 0; i < chs.length; i++) { buf.writeChar(chs[i]);/*www . j av a 2 s . co m*/ } }
From source file:com.crowsofwar.gorecore.util.VectorI.java
License:Open Source License
/** * Writes this vector to the packet byte buffer. * /*w w w . ja va2 s. co m*/ * @param buf * Buffer to write to */ public void toBytes(ByteBuf buf) { buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); }
From source file:com.datastax.driver.core.CBUtil.java
License:Apache License
public static void writeLongString(String str, ByteBuf cb) { byte[] bytes = str.getBytes(CharsetUtil.UTF_8); cb.writeInt(bytes.length); cb.writeBytes(bytes);/*from w ww . ja v a2 s . c om*/ }
From source file:com.datastax.driver.core.CBUtil.java
License:Apache License
public static void writeValue(byte[] bytes, ByteBuf cb) { if (bytes == null) { cb.writeInt(-1); return;/* w w w . j a v a 2 s.c o m*/ } cb.writeInt(bytes.length); cb.writeBytes(bytes); }
From source file:com.datastax.driver.core.CBUtil.java
License:Apache License
public static void writeValue(ByteBuffer bytes, ByteBuf cb) { if (bytes == null) { cb.writeInt(-1); return;//from w ww . j ava 2 s . c o m } if (bytes == BoundStatement.UNSET) { cb.writeInt(-2); return; } cb.writeInt(bytes.remaining()); cb.writeBytes(bytes.duplicate()); }
From source file:com.datastax.driver.core.CBUtil.java
License:Apache License
public static void writeInet(InetSocketAddress inet, ByteBuf cb) { byte[] address = inet.getAddress().getAddress(); cb.writeByte(address.length);//from w w w . java 2s . c om cb.writeBytes(address); cb.writeInt(inet.getPort()); }