Example usage for io.netty.buffer ByteBuf readDouble

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

Introduction

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

Prototype

public abstract double readDouble();

Source Link

Document

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

Usage

From source file:com.Da_Technomancer.crossroads.API.packets.Message.java

License:Creative Commons License

private static double readDouble(ByteBuf buf) {
    return buf.readDouble();
}

From source file:com.Da_Technomancer.crossroads.API.packets.Message.java

License:Creative Commons License

private static double[] readDoubleArray(ByteBuf buf) {
    int size = buf.readInt();
    double[] out = new double[size];
    for (int i = 0; i < size; i++) {
        out[i] = buf.readDouble();
    }/*from w ww.java 2 s .co  m*/
    return out;
}

From source file:com.eightkdata.mongowp.bson.netty.DefaultNettyBsonLowLevelReader.java

License:Open Source License

@Override
BsonDouble readDouble(@Loose @ModifiesIndexes ByteBuf byteBuf) {
    return PrimitiveBsonDouble.newInstance(byteBuf.readDouble());
}

From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java

License:Apache License

/**
 * {@inheritDoc}/*from www .ja  v a2 s.c  o  m*/
 * @see com.heliosapm.ohcrs.core.DriverCodec#readDouble(io.netty.buffer.ByteBuf)
 */
@Override
public Double readDouble(final ByteBuf b) throws SQLException {
    if (checkNull(b))
        return null;
    return b.readDouble();
}

From source file:com.heliosapm.ohcrs.core.AbstractDriverCodec.java

License:Apache License

/**
 * {@inheritDoc}//ww  w.  j  a  v  a2  s .co m
 * @see com.heliosapm.ohcrs.core.DriverCodec#readdouble(io.netty.buffer.ByteBuf)
 */
@Override
public double readdouble(final ByteBuf b) throws SQLException {
    if (checkNull(b))
        return 0D;
    return b.readDouble();
}

From source file:com.heliosapm.streams.metrics.StreamedMetricValue.java

License:Apache License

/**
 * Updates this StreamedMetricValue using the next serialized version in the passed ByteBuf. 
 * @param buf The buffer to update from//from w  ww  .  jav  a  2 s  .  co  m
 * @return this StreamedMetricValue
 */
@Override
public StreamedMetricValue update(final ByteBuf buf) {
    super.update(buf);
    if (buf.readByte() == ZERO_BYTE) {
        isDoubleValue = true;
        doubleValue = buf.readDouble();
    } else {
        isDoubleValue = false;
        longValue = buf.readLong();
    }
    return this;
}

From source file:com.heliosapm.streams.metrics.StreamedMetricValue.java

License:Apache License

/**
 * Reads a StreamedMetricValue from the passed buffer
 * @param buff The buffer to read from//ww w  .j  ava  2 s .co  m
 * @return the StreamedMetricValue
 */
public static StreamedMetricValue from(final ByteBuf buff) {
    buff.readByte();
    final byte vt = buff.readByte();
    final ValueType valueType = vt == 0 ? null : ValueType.ordinal(vt);
    final long ts = buff.readLong();
    final String mn = BufferManager.readUTF(buff);
    final int tagCount = buff.readByte();
    final Map<String, String> tags = new HashMap<String, String>(tagCount);
    for (int i = 0; i < tagCount; i++) {
        tags.put(BufferManager.readUTF(buff), BufferManager.readUTF(buff));
    }
    final byte lord = buff.readByte();
    if (lord == 0) {
        return new StreamedMetricValue(ts, buff.readDouble(), mn, tags).setValueType(valueType);
    }
    return new StreamedMetricValue(ts, buff.readLong(), mn, tags).setValueType(valueType);

}

From source file:com.heliosapm.streams.metrics.StreamedMetricValue.java

License:Apache License

/**
 * Creates a StreamedMetricValue from the passed buffer
 * @param bytes The byte to read the StreamedMetric from
 * @return the created StreamedMetric/*from   w w  w. j av  a 2 s.c o m*/
 */
static StreamedMetricValue fromBuff(final ByteBuf buff) {
    final StreamedMetricValue sm = new StreamedMetricValue();
    sm.byteSize = buff.readableBytes() + 1;
    sm.readFromBuff(buff);
    final byte type = buff.readByte();
    if (type == 0) {
        sm.isDoubleValue = true;
        sm.doubleValue = buff.readDouble();
    } else {
        sm.isDoubleValue = false;
        sm.longValue = buff.readLong();
    }
    return sm;
}

From source file:com.minemaarten.signals.network.PacketSpawnParticle.java

License:LGPL

@Override
public void fromBytes(ByteBuf buffer) {
    super.fromBytes(buffer);
    particleId = buffer.readInt();//from   w w w. j  av  a2  s.c o m
    dx = buffer.readDouble();
    dy = buffer.readDouble();
    dz = buffer.readDouble();
}

From source file:com.mrcrayfish.furniture.network.message.MessageFart.java

License:Open Source License

@Override
public void fromBytes(ByteBuf buf) {
    this.x = buf.readDouble();
    this.y = buf.readDouble();
    this.z = buf.readDouble();
}