Example usage for java.io DataInput readDouble

List of usage examples for java.io DataInput readDouble

Introduction

In this page you can find the example usage for java.io DataInput readDouble.

Prototype

double readDouble() throws IOException;

Source Link

Document

Reads eight input bytes and returns a double value.

Usage

From source file:Main.java

/**
 * Reads a double[] from a DataInput//ww w .  j a  va2s .c  om
 * @throws java.io.IOException
 */
public static double[] readDoubleArray(DataInput in) throws IOException {
    int length = in.readInt();
    double[] array = new double[length];
    for (int index = 0; index < length; index++) {
        array[index] = in.readDouble();
    }

    return array;
}

From source file:com.chinamobile.bcbsp.ml.VectorWritable.java

public static DoubleVector readVector(DataInput in) throws IOException {
    int length = in.readInt();
    DoubleVector vector;/*w w  w.j a va  2 s.c o  m*/
    vector = new DenseDoubleVector(length);
    for (int i = 0; i < length; i++) {
        vector.set(i, in.readDouble());
    }

    if (in.readBoolean()) {
        vector = new NamedDoubleVector(in.readUTF(), vector);
    }
    return vector;
}

From source file:com.martinkampjensen.thesis.util.gromacs.EnergyExtractor.java

private static double readReal(DataInput input, boolean useDoublePrecision) throws IOException {
    if (useDoublePrecision) {
        return input.readDouble();
    } else {//from   ww  w. j av  a 2 s.co  m
        return input.readFloat();
    }
}

From source file:RandomFileTest.java

public void readData(DataInput in) throws IOException {
    name = DataIO.readFixedString(NAME_SIZE, in);
    salary = in.readDouble();
}

From source file:inflater.datatypes.writable.CoordinateWritable.java

@Override
public void readFields(DataInput in) throws IOException {
    coordinate.x = in.readDouble();
    coordinate.y = in.readDouble();/*from w ww .  j a  va2  s.  co  m*/
    coordinate.z = in.readDouble();
}

From source file:RandomFileTest.java

/**
   Reads employee data from a data input
   @param in the data input/*from w  w w .j a  va  2s . co  m*/
*/
public void readData(DataInput in) throws IOException {
    name = DataIO.readFixedString(NAME_SIZE, in);
    salary = in.readDouble();
    int y = in.readInt();
    int m = in.readInt();
    int d = in.readInt();
    GregorianCalendar calendar = new GregorianCalendar(y, m - 1, d);
    hireDay = calendar.getTime();
}

From source file:org.springdata.ehcache.core.Book.java

@Override
public void readFields(DataInput in) throws IOException {
    id = in.readLong();//  ww w  .  j  a v  a  2s . c o  m
    author = in.readUTF();
    price = in.readDouble();
}

From source file:edu.umn.cs.spatialHadoop.indexing.GridPartitioner.java

@Override
public void readFields(DataInput in) throws IOException {
    this.x = in.readDouble();
    this.y = in.readDouble();
    this.tileWidth = in.readDouble();
    this.tileHeight = in.readDouble();
    this.numTiles = in.readInt();
    this.numColumns = (int) Math.round(Math.sqrt(numTiles));
    this.numRows = (int) Math.ceil(numTiles / numColumns);
}

From source file:eu.stratosphere.nephele.streaming.message.qosreport.VertexLatency.java

/**
 * {@inheritDoc}/* w w w.  ja v  a  2 s.c o  m*/
 */
@Override
public void read(final DataInput in) throws IOException {
    this.reporterID = new QosReporterID.Vertex();
    this.reporterID.read(in);
    this.vertexLatency = in.readDouble();
}

From source file:eu.stratosphere.nephele.streaming.message.qosreport.EdgeLatency.java

/**
 * {@inheritDoc}/*  w w w.ja  v  a 2s . c o m*/
 */
@Override
public void read(final DataInput in) throws IOException {
    this.reporterID = new QosReporterID.Edge();
    this.reporterID.read(in);
    this.edgeLatency = in.readDouble();
    this.counter = 1;
}