Example usage for io.netty.buffer ByteBuf readLong

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

Introduction

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

Prototype

public abstract long readLong();

Source Link

Document

Gets a 64-bit integer at the current readerIndex and increases the readerIndex by 8 in this buffer.

Usage

From source file:org.projectfloodlight.openflow.protocol.ver13.OFBsnEnhancedHashTypeSerializerVer13.java

public static Set<OFBsnEnhancedHashType> readFrom(ByteBuf bb) throws OFParseError {
    try {/*from w ww  . j a v  a 2  s  .co m*/
        return ofWireValue(bb.readLong());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:org.projectfloodlight.openflow.protocol.ver13.OFBsnHashPacketFieldSerializerVer13.java

public static Set<OFBsnHashPacketField> readFrom(ByteBuf bb) throws OFParseError {
    try {/*from www.  j a  v a  2  s.c  o m*/
        return ofWireValue(bb.readLong());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:org.projectfloodlight.openflow.protocol.ver13.OFBsnTunnelTypeSerializerVer13.java

public static Set<OFBsnTunnelType> readFrom(ByteBuf bb) throws OFParseError {
    try {/*from   w w w. jav a2  s. c  o m*/
        return ofWireValue(bb.readLong());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:org.projectfloodlight.openflow.protocol.ver14.OFBsnMiscCapabilitiesSerializerVer14.java

public static Set<OFBsnMiscCapabilities> readFrom(ByteBuf bb) throws OFParseError {
    try {/*from  w  ww  . j  a v  a2  s  .c o  m*/
        return ofWireValue(bb.readLong());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:org.projectfloodlight.openflow.protocol.ver14.OFBsnSpeedCapabilitiesSerializerVer14.java

public static Set<OFBsnSpeedCapabilities> readFrom(ByteBuf bb) throws OFParseError {
    try {/*from  www .java2 s .c o  m*/
        return ofWireValue(bb.readLong());
    } catch (IllegalArgumentException e) {
        throw new OFParseError(e);
    }
}

From source file:org.redisson.codec.MapCacheEventCodec.java

License:Apache License

private Object decode(ByteBuf buf, State state, Decoder<?> decoder) throws IOException {
    int keyLen;/*  w ww.j a va 2s.  co m*/
    if (osType == OSType.WINDOWS) {
        keyLen = buf.readIntLE();
    } else if (osType == OSType.HPNONSTOP) {
        keyLen = (int) buf.readLong();
    } else {
        keyLen = (int) buf.readLongLE();
    }
    ByteBuf keyBuf = buf.readSlice(keyLen);
    Object key = decoder.decode(keyBuf, state);
    return key;
}

From source file:org.rhq.metrics.netty.collectd.packet.CollectdPacketDecoder.java

License:Apache License

private Values readValuePartContent(ByteBuf content, int length) {
    int beginIndex = content.readerIndex();
    int total = content.readUnsignedShort();
    DataType[] dataTypes = new DataType[total];
    for (int i = 0; i < total; i++) {
        byte sampleTypeId = content.readByte();
        dataTypes[i] = DataType.findById(sampleTypeId);
    }//from  w  w  w .  jav  a 2  s. c om
    Number[] data = new Number[total];
    for (int i = 0; i < total; i++) {
        DataType dataType = dataTypes[i];
        switch (dataType) {
        case COUNTER:
        case ABSOLUTE:
            byte[] valueBytes = new byte[8];
            content.readBytes(valueBytes);
            data[i] = new BigInteger(1, valueBytes);
            break;
        case DERIVE:
            data[i] = content.readLong();
            break;
        case GAUGE:
            data[i] = Double.longBitsToDouble(ByteBufUtil.swapLong(content.readLong()));
            break;
        default:
            logger.debug("Skipping unknown data type: {}", dataType);
        }
    }
    // Skip any additionnal bytes
    int readCount = content.readerIndex() - beginIndex;
    if (length > readCount) {
        content.skipBytes(readCount - length);
    }
    return new Values(dataTypes, data);
}

From source file:org.spongepowered.clean.network.packet.play.serverbound.SpectatePacket.java

License:MIT License

@Override
public void read(ByteBuf buffer) {
    long most = buffer.readLong();
    long least = buffer.readLong();
    this.uuid = new UUID(most, least);
}

From source file:org.spongepowered.clean.network.packet.status.PingPacket.java

License:MIT License

@Override
public void read(ByteBuf buffer) {
    this.nonce = buffer.readLong();
}

From source file:org.spongepowered.clean.util.ByteBufUtil.java

License:MIT License

public static Vector3i readPosition(ByteBuf buffer) {
    long val = buffer.readLong();
    int x = (int) (val >> 38);
    int y = (int) ((val >> 26) & 0xFFF);
    int z = (int) (val & 0x3FFFFFF);
    return new Vector3i(x, y, z);
}