Example usage for io.netty.buffer ByteBuf readShort

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

Introduction

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

Prototype

public abstract short readShort();

Source Link

Document

Gets a 16-bit short integer at the current readerIndex and increases the readerIndex by 2 in this buffer.

Usage

From source file:com.ltln.modules.openflow.core.protocol.ver14.OFAsyncConfigFailedCodeSerializerVer14.java

public static OFAsyncConfigFailedCode readFrom(ByteBuf bb) throws OFParseError {
    try {/*w ww  . ja v a  2 s  .c om*/
        return ofWireValue(bb.readShort());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:com.ltln.modules.openflow.core.protocol.ver14.OFBadPropertyCodeSerializerVer14.java

public static OFBadPropertyCode readFrom(ByteBuf bb) throws OFParseError {
    try {// w  w  w . ja  v  a2 s  .  c o m
        return ofWireValue(bb.readShort());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:com.ltln.modules.openflow.core.protocol.ver14.OFBundleCtrlTypeSerializerVer14.java

public static OFBundleCtrlType readFrom(ByteBuf bb) throws OFParseError {
    try {/*from w ww  .  j  a v  a  2s .c o  m*/
        return ofWireValue(bb.readShort());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:com.ltln.modules.openflow.core.protocol.ver14.OFBundleFailedCodeSerializerVer14.java

public static OFBundleFailedCode readFrom(ByteBuf bb) throws OFParseError {
    try {/*from www .java  2  s.  c  o  m*/
        return ofWireValue(bb.readShort());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:com.ltln.modules.openflow.core.protocol.ver14.OFBundleFlagsSerializerVer14.java

public static Set<OFBundleFlags> readFrom(ByteBuf bb) throws OFParseError {
    try {/*  w w  w.j av  a  2 s.  c  om*/
        return ofWireValue(bb.readShort());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:com.ltln.modules.openflow.core.protocol.ver14.OFFlowMonitorFailedCodeSerializerVer14.java

public static OFFlowMonitorFailedCode readFrom(ByteBuf bb) throws OFParseError {
    try {//from w w w.j a  v a  2s .  c om
        return ofWireValue(bb.readShort());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:com.ltln.modules.openflow.core.protocol.ver14.OFPortStatsPropTypeSerializerVer14.java

public static OFPortStatsPropType readFrom(ByteBuf bb) throws OFParseError {
    try {/*  w w w  .  j  av a 2 s. c om*/
        return ofWireValue(bb.readShort());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:com.mpush.api.protocol.Packet.java

License:Apache License

public static Packet decodePacket(Packet packet, ByteBuf in, int bodyLength) {
    packet.cc = in.readShort();//read cc
    packet.flags = in.readByte();//read flags
    packet.sessionId = in.readInt();//read sessionId
    packet.lrc = in.readByte();//read lrc

    //read body/*from   w  ww  . j  av  a2  s  .co  m*/
    if (bodyLength > 0) {
        in.readBytes(packet.body = new byte[bodyLength]);
    }
    return packet;
}

From source file:com.mpush.common.message.ByteBufMessage.java

License:Apache License

public byte[] decodeBytes(ByteBuf body) {
    int fieldLength = body.readShort();
    if (fieldLength == 0)
        return null;
    if (fieldLength == Short.MAX_VALUE) {
        fieldLength += body.readInt();/*from  ww w .ja v a  2  s .com*/
    }
    byte[] bytes = new byte[fieldLength];
    body.readBytes(bytes);
    return bytes;
}

From source file:com.quavo.osrs.game.model.entity.actor.player.info.MachineInformation.java

License:Open Source License

/**
 * Decodes the machine information of the user during the {@link WorldLoginDecoder}.
 * /*from   ww  w. j a  v  a  2 s .co m*/
 * @param buffer The {@link ByteBuf}.
 * @return The created machine information.
 */
public static MachineInformation decode(ByteBuf buffer) {
    buffer.readByte();
    int osArch = buffer.readByte();
    boolean is64Bit = buffer.readByte() == 1;
    int osBuild = buffer.readByte();
    int vendor = buffer.readByte();
    buffer.readByte();
    buffer.readByte();
    buffer.readByte();
    buffer.readByte();
    buffer.readShort();
    buffer.readByte();
    buffer.readMedium();
    buffer.readShort();
    ByteBufUtils.readJagString(buffer);
    ByteBufUtils.readJagString(buffer);
    ByteBufUtils.readJagString(buffer);
    ByteBufUtils.readJagString(buffer);
    buffer.readByte();
    buffer.readShort();
    ByteBufUtils.readJagString(buffer);
    ByteBufUtils.readJagString(buffer);
    buffer.readByte();
    buffer.readByte();
    return new MachineInformation(osArch, is64Bit, osBuild, vendor);
}