Example usage for io.netty.buffer ByteBuf getDouble

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

Introduction

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

Prototype

public abstract double getDouble(int index);

Source Link

Document

Gets a 64-bit floating point number at the specified absolute index in this buffer.

Usage

From source file:io.reactiverse.pgclient.impl.codec.DataTypeCodec.java

License:Apache License

private static Double binaryDecodeFLOAT8(int index, int len, ByteBuf buff) {
    return buff.getDouble(index);
}

From source file:org.nd4j.linalg.api.buffer.DoubleDataBufferTest.java

License:Apache License

@Test
public void testNettyCopy() {
    DataBuffer db = Nd4j.createBuffer(new double[] { 1, 2, 3, 4 });
    ByteBuf buf = db.asNetty();//  ww w  . j av a 2s.co  m
    if (db.allocationMode() == DataBuffer.AllocationMode.HEAP)
        return;

    ByteBuf copy = buf.copy(0, buf.capacity());
    for (int i = 0; i < db.length(); i++) {
        assertEquals(db.getDouble(i), copy.getDouble(i * 8));
    }
}