Example usage for io.netty.buffer ByteBuf writeByte

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

Introduction

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

Prototype

public abstract ByteBuf writeByte(int value);

Source Link

Document

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

Usage

From source file:buildcraft.transport.utils.FacadeMatrix.java

License:Minecraft Mod Public

public void writeData(ByteBuf data) {
    for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
        if (blocks[i] == null) {
            data.writeShort(0);/*from   w  w  w.  ja  v a2s.  c o  m*/
        } else {
            data.writeShort(Block.blockRegistry.getIDForObject(blocks[i]));
        }

        data.writeByte(blockMetas[i]);
    }
}

From source file:buildcraft.transport.utils.TextureMatrix.java

License:Minecraft Mod Public

public void writeData(ByteBuf data) {
    for (int iconIndexe : iconIndexes) {
        data.writeByte(iconIndexe);
    }
}

From source file:buildcraft.transport.utils.WireMatrix.java

License:Minecraft Mod Public

public void writeData(ByteBuf data) {
    data.writeByte(bitSetCodec.encode(hasWire));

    for (int i = 0; i < PipeWire.values().length; i++) {
        wires[i].writeData(data);/*from   w  w w  . j av  a 2  s .c  o m*/
        data.writeByte(wireIconIndex[i]);
    }
}

From source file:buildcraftAdditions.api.configurableOutput.SideConfiguration.java

License:GNU General Public License

@Override
public void writeToByteBuff(ByteBuf buf) {
    for (ForgeDirection direction : VALID_DIRECTIONS) {
        buf.writeByte(getStatus(direction).ordinal());
        buf.writeByte(getPriority(direction).ordinal());
    }/* w  ww.  java 2  s  .co  m*/
}

From source file:buildcraftAdditions.networking.MessagePipeColoringTool.java

License:GNU General Public License

@Override
public void toBytes(ByteBuf buf) {
    buf.writeByte(color);
    buf.writeBoolean(sortMode);
}

From source file:buildcraftAdditions.tileEntities.TileItemSorter.java

License:GNU General Public License

@Override
public void writeToByteBuff(ByteBuf buf) {
    buf.writeByte(rotation.ordinal());
    buf.writeBytes(colors);
}

From source file:buildcraftAdditions.tileEntities.varHelpers.Upgrades.java

License:GNU General Public License

@Override
public void writeToByteBuff(ByteBuf buf) {
    buf.writeByte(maxUpgrades);
    buf.writeByte(upgrades.size());/*from ww w  .  ja v a2  s.  c o m*/
    for (EnumMachineUpgrades upgrade : upgrades)
        buf.writeByte(upgrade.ordinal());
}

From source file:cc.blynk.integration.model.websocket.AppWebSocketClient.java

License:Apache License

private static WebSocketFrame produceWebSocketFrame(MessageBase msg) {
    byte[] data = msg.getBytes();
    ByteBuf bb = ByteBufAllocator.DEFAULT.buffer(3 + data.length);
    bb.writeByte(msg.command);
    bb.writeShort(msg.id);/*from   w  w w . ja v a  2s  .c  o m*/
    bb.writeBytes(data);
    return new BinaryWebSocketFrame(bb);
}

From source file:cc.blynk.integration.model.websocket.WebSocketClient.java

License:Apache License

private static WebSocketFrame produceWebSocketFrame(MessageBase msg) {
    ByteBuf bb = PooledByteBufAllocator.DEFAULT.heapBuffer(5 + msg.length);
    bb.writeByte(msg.command);
    bb.writeShort(msg.id);/*from  w w  w .  jav a2s  .c o m*/
    bb.writeShort(msg.length);
    byte[] data = msg.getBytes();
    if (data != null) {
        bb.writeBytes(data);
    }
    return new BinaryWebSocketFrame(bb);
}

From source file:cc.changic.platform.etl.schedule.http.HttpHeaderUtil.java

License:Apache License

static void encodeAscii0(CharSequence seq, ByteBuf buf) {
    int length = seq.length();
    for (int i = 0; i < length; i++) {
        buf.writeByte((byte) seq.charAt(i));
    }// ww  w.  j av a2 s .c om
}