Example usage for java.io DataInputStream readFloat

List of usage examples for java.io DataInputStream readFloat

Introduction

In this page you can find the example usage for java.io DataInputStream readFloat.

Prototype

public final float readFloat() throws IOException 

Source Link

Document

See the general contract of the readFloat method of DataInput.

Usage

From source file:org.nd4j.linalg.util.ArrayUtil.java

public static float[] readFloat(int length, DataInputStream dis) throws IOException {
    float[] ret = new float[length];
    for (int i = 0; i < length; i++)
        ret[i] = dis.readFloat();
    return ret;//w  w  w .  j ava2 s. co m
}

From source file:org.structr.core.graph.SyncCommand.java

private static Object readObject(final DataInputStream inputStream, final byte type) throws IOException {

    switch (type) {

    case 0://from   w  w w.  j  ava  2 s.  c om
    case 1:
        return inputStream.readByte();

    case 2:
    case 3:
        return inputStream.readShort();

    case 4:
    case 5:
        return inputStream.readInt();

    case 6:
    case 7:
        return inputStream.readLong();

    case 8:
    case 9:
        return inputStream.readFloat();

    case 10:
    case 11:
        return inputStream.readDouble();

    case 12:
    case 13:
        return inputStream.readChar();

    case 14:
    case 15:
        return new String(deserializeData(inputStream), "UTF-8");

    // this doesn't work with very long strings
    //return inputStream.readUTF();

    case 16:
    case 17:
        return inputStream.readBoolean();
    }

    return null;
}

From source file:src.util.Vec2D.java

public Vec2D loadFrom(DataInputStream in) throws Exception {
    x = in.readFloat();
    y = in.readFloat();//from ww w.  j  a  va  2  s  .  c  o m
    return this;
}

From source file:src.util.Vec3D.java

public Vec3D loadFrom(DataInputStream in) throws Exception {
    x = in.readFloat();
    y = in.readFloat();// w  ww. j a va  2s  .  co m
    z = in.readFloat();
    return this;
}