Example usage for io.netty.buffer ByteBuf writeBoolean

List of usage examples for io.netty.buffer ByteBuf writeBoolean

Introduction

In this page you can find the example usage for io.netty.buffer ByteBuf writeBoolean.

Prototype

public abstract ByteBuf writeBoolean(boolean value);

Source Link

Document

Sets the specified boolean at the current writerIndex and increases the writerIndex by 1 in this buffer.

Usage

From source file:eu.xworlds.util.raknet.protocol.OpenConnectionReply1.java

License:Open Source License

@Override
public ByteBuf encode() {
    int size = 1 + this.magic.length + SIZE_GUID + 1 + 2;
    if (this.hasSecurity) {
        size += 4 + this.publicKey.length;
    }/*w w w  . ja  v  a  2s  . c  om*/
    final ByteBuf result = Unpooled.buffer(size);
    result.order(ByteOrder.BIG_ENDIAN);
    result.writeByte(ID);
    result.writeBytes(this.magic);
    writeGuid(result, this.serverGuid);
    result.writeBoolean(this.hasSecurity);
    if (this.hasSecurity) {
        result.writeInt(this.securityCookie);
        result.writeBytes(this.publicKey);
    }
    writeUnsignedShort(result, this.mtuSize);
    return result;
}

From source file:eu.xworlds.util.raknet.protocol.OpenConnectionReply2.java

License:Open Source License

@Override
public ByteBuf encode() {
    int size = 1 + this.magic.length + SIZE_GUID + 2 + 2 + 1;
    if (this.doSecurity) {
        size += this.securityAnswer.length;
    }//from   ww  w  .  j  av  a 2s.  c  o  m
    final ByteBuf buf = Unpooled.buffer(size);
    buf.order(ByteOrder.BIG_ENDIAN);
    buf.writeByte(ID);
    buf.writeBytes(this.magic);
    writeGuid(buf, this.serverGuid);
    writeUnsignedShort(buf, this.port);
    writeUnsignedShort(buf, this.mtuSize);
    buf.writeBoolean(this.doSecurity);
    if (this.doSecurity) {
        buf.writeBytes(this.securityAnswer);
    }
    return buf;
}

From source file:eu.xworlds.util.raknet.protocol.OpenConnectionRequest2.java

License:Open Source License

@Override
public ByteBuf encode() {
    int size = 1 + this.magic.length + SIZE_IPV4_ADDRESS + 2 + SIZE_GUID;
    if (this.useSecurity) {
        size += 4 + 1;//w  w w  .  j  a va2s  . c o m
        if (this.clientWroteChallenge) {
            size += this.clientChallenge.length;
        }
    }
    final ByteBuf buf = Unpooled.buffer(size);
    buf.order(ByteOrder.BIG_ENDIAN);
    buf.writeByte(ID);
    buf.writeBytes(this.magic);
    if (this.useSecurity) {
        buf.writeInt(this.cookie);
        buf.writeBoolean(this.clientWroteChallenge);
        if (this.clientWroteChallenge) {
            buf.writeBytes(this.clientChallenge);
        }
    }
    writeIpv4Address(buf, this.bindingAddress);
    writeUnsignedShort(buf, this.mtuSize);
    writeGuid(buf, this.guid);
    return buf;
}

From source file:eureka.networking.MessageResearch.java

License:GNU General Public License

@Override
public void toBytes(ByteBuf buf) {
    for (IEurekaInfo info : EurekaAPI.API.getAllKeys()) {
        buf.writeInt(research.getProgress(info.getName()));
        buf.writeBoolean(research.isFinished(info.getName()));
    }/*  ww w .  j  a v a  2  s. c  o m*/
}

From source file:gravestone.packets.GraveDeathMessageToServer.java

License:LGPL

@Override
public void toBytes(ByteBuf buf) {
    buf.writeInt(dimensionID);//from w ww  .j a  va  2 s .  c  o  m
    buf.writeInt(x);
    buf.writeInt(y);
    buf.writeInt(z);
    ByteBufUtils.writeUTF8String(buf, text);
    buf.writeBoolean(randomText);

}

From source file:growthcraft.milk.common.struct.CheeseCurd.java

License:Open Source License

@Override
public boolean writeToStream(ByteBuf stream) {
    cheese.writeToStream(stream);/*from  ww  w . ja va2s .c  o  m*/
    stream.writeBoolean(dried);
    stream.writeInt(age);
    return false;
}

From source file:hellfirepvp.astralsorcery.common.integrations.mods.crafttweaker.network.BaseAltarRecipe.java

License:Open Source License

@Override
public void write(ByteBuf buf) {
    buf.writeInt(this.starlightRequired);
    buf.writeInt(this.craftingTickTime);
    ByteBufUtils.writeItemStack(buf, this.output);
    buf.writeInt(this.inputs.length);
    for (ItemHandle handle : this.inputs) {
        buf.writeBoolean(handle != null);
        if (handle != null) {
            handle.serialize(buf);/*from www .  j a v  a 2 s. com*/
        }
    }
}

From source file:hellfirepvp.astralsorcery.common.integrations.mods.crafttweaker.network.InfusionRecipeAdd.java

License:Open Source License

@Override
public void write(ByteBuf buf) {
    ByteBufUtils.writeItemStack(buf, this.in);
    ByteBufUtils.writeItemStack(buf, this.out);
    buf.writeBoolean(this.consumeAll);
    buf.writeFloat(this.consumeChance);
    buf.writeInt(this.craftingTickTime);
}

From source file:hellfirepvp.astralsorcery.common.integrations.mods.crafttweaker.network.LightTransmutationRemove.java

License:Open Source License

@Override
public void write(ByteBuf buf) {
    ByteBufUtils.writeItemStack(buf, this.matchStack);
    buf.writeBoolean(this.matchMeta);
}

From source file:hellfirepvp.astralsorcery.common.integrations.mods.crafttweaker.network.WellRecipeRemove.java

License:Open Source License

@Override
public void write(ByteBuf buf) {
    ByteBufUtils.writeItemStack(buf, this.matchIn);
    boolean defined = this.fluidOut != null;
    buf.writeBoolean(defined);
    if (defined) {
        ByteBufUtils.writeString(buf, this.fluidOut.getName());
    }// w w  w.j av  a 2 s  . c om
}