List of usage examples for io.netty.buffer ByteBuf writeDouble
public abstract ByteBuf writeDouble(double value);
From source file:hellfirepvp.astralsorcery.common.network.packet.server.PktSyncKnowledge.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { buf.writeByte(state);//from w w w .ja v a 2s . c om if (knownConstellations != null) { buf.writeInt(knownConstellations.size()); for (String dat : knownConstellations) { ByteBufUtils.writeString(buf, dat); } } else { buf.writeInt(-1); } if (seenConstellations != null) { buf.writeInt(seenConstellations.size()); for (String dat : seenConstellations) { ByteBufUtils.writeString(buf, dat); } } else { buf.writeInt(-1); } if (researchProgression != null) { buf.writeInt(researchProgression.size()); for (ResearchProgression progression : researchProgression) { buf.writeInt(progression.getProgressId()); } } else { buf.writeInt(-1); } if (attunedConstellation != null) { buf.writeByte(1); ByteBufUtils.writeString(buf, attunedConstellation.getUnlocalizedName()); } else { buf.writeByte(-1); } if (appliedPerks != null) { buf.writeInt(appliedPerks.size()); for (ConstellationPerk perk : appliedPerks.keySet()) { buf.writeInt(perk.getId()); buf.writeInt(appliedPerks.get(perk)); } } else { buf.writeInt(-1); } buf.writeBoolean(this.wasOnceAttuned); buf.writeInt(this.progressTier); buf.writeDouble(this.alignmentCharge); }
From source file:hellfirepvp.astralsorcery.common.util.data.Vector3.java
License:Open Source License
public void toBytes(ByteBuf buf) { buf.writeDouble(this.x); buf.writeDouble(this.y); buf.writeDouble(this.z); }
From source file:herddb.proto.PduCodec.java
License:Apache License
private static void writeObject(ByteBuf byteBuf, Object v) { if (v == null) { byteBuf.writeByte(TYPE_NULL);//from ww w . j a v a 2s .co m } else if (v instanceof RawString) { byteBuf.writeByte(TYPE_STRING); ByteBufUtils.writeRawString(byteBuf, (RawString) v); } else if (v instanceof String) { byteBuf.writeByte(TYPE_STRING); ByteBufUtils.writeString(byteBuf, (String) v); } else if (v instanceof Long) { byteBuf.writeByte(TYPE_LONG); byteBuf.writeLong((Long) v); } else if (v instanceof Integer) { byteBuf.writeByte(TYPE_INTEGER); byteBuf.writeInt((Integer) v); } else if (v instanceof Boolean) { byteBuf.writeByte(TYPE_BOOLEAN); byteBuf.writeBoolean((Boolean) v); } else if (v instanceof java.util.Date) { byteBuf.writeByte(TYPE_TIMESTAMP); byteBuf.writeLong(((java.util.Date) v).getTime()); } else if (v instanceof Double) { byteBuf.writeByte(TYPE_DOUBLE); byteBuf.writeDouble((Double) v); } else if (v instanceof Float) { byteBuf.writeByte(TYPE_DOUBLE); byteBuf.writeDouble((Float) v); } else if (v instanceof Short) { byteBuf.writeByte(TYPE_SHORT); byteBuf.writeLong((Short) v); } else if (v instanceof byte[]) { byteBuf.writeByte(TYPE_BYTEARRAY); ByteBufUtils.writeArray(byteBuf, (byte[]) v); } else if (v instanceof Byte) { byteBuf.writeByte(TYPE_BYTE); byteBuf.writeByte((Byte) v); } else { throw new IllegalArgumentException("bad data type " + v.getClass()); } }
From source file:io.crate.protocols.postgres.types.DoubleType.java
License:Apache License
@Override public int writeAsBinary(ByteBuf buffer, @Nonnull Object value) { buffer.writeInt(TYPE_LEN);//from ww w . j av a 2s . c o m buffer.writeDouble(((double) value)); return INT32_BYTE_SIZE + TYPE_LEN; }
From source file:io.crate.protocols.postgres.types.TimestampType.java
License:Apache License
@Override public int writeAsBinary(ByteBuf buffer, @Nonnull Object value) { buffer.writeInt(TYPE_LEN);/*from w w w .j a v a2s . c o m*/ buffer.writeDouble(toPgTimestamp((long) value)); return INT32_BYTE_SIZE + TYPE_LEN; }
From source file:io.github.stormcloud_dev.stormcloud.frame.clientbound.ActivateObjectClientBoundFrame.java
License:Apache License
@Override public void writeData(ByteBuf buf) { super.writeData(buf); buf.writeDouble(getPlayerX()); buf.writeDouble(getPlayerY());// w w w . java2 s .co m buf.writeShort(getObjectActivated()); buf.writeShort(getObjectMId()); buf.writeByte(getActiveState()); buf.writeByte(getSuccess()); }
From source file:io.github.stormcloud_dev.stormcloud.frame.clientbound.AddPlayerClientBoundFrame.java
License:Apache License
@Override public void writeData(ByteBuf buf) { super.writeData(buf); buf.writeDouble(getX()); buf.writeDouble(getY());/*from www . ja v a 2s. com*/ buf.writeDouble(getMId()); buf.writeInt(getClazz()); buf.writeInt(getHostPlayer()); for (byte b : getName().getBytes()) { buf.writeByte(b); } buf.writeByte(0); }
From source file:io.github.stormcloud_dev.stormcloud.frame.clientbound.ClientBoundFrame.java
License:Apache License
@Override public void writeData(ByteBuf buf) { super.writeData(buf); buf.writeDouble(getObjectIndex()); buf.writeDouble(getMultiplayerId()); }
From source file:io.github.stormcloud_dev.stormcloud.frame.clientbound.CreateLevelObjectClientBoundFrame.java
License:Apache License
@Override public void writeData(ByteBuf buf) { super.writeData(buf); buf.writeDouble(getUnknown1()); buf.writeDouble(getUnknown2());//from www . j a v a 2 s . c o m buf.writeDouble(getUnknown3()); buf.writeDouble(getUnknown4()); buf.writeInt(getUnknown5()); }
From source file:io.github.stormcloud_dev.stormcloud.frame.clientbound.CreateObjectClientBoundFrame.java
License:Apache License
@Override public void writeData(ByteBuf buf) { super.writeData(buf); buf.writeDouble(getX()); buf.writeDouble(getY()); }