1

I have a problem reading 32Bit Float Values from an InputStream recieved from an API.

The File-Format ist described in the API Documentation as:

width x height x nbFrames 32-bit floating point pressure values, stored frame by frame and in row-major fashion

I´m currently Reading the Float Values like this

 DataInputStream dis = new DataInputStream(is);

 while (dis.available() > 0) {

        byte[] float_val = new byte[4];
        dis.readFully(float_val);
        float f = ByteBuffer.wrap(float_val).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        System.out.println(f);

   }

Since the ByteOrder is not mentioned in the Documentation i assumed it will be Little Endian since I tested with Big Endian aswell but the Value i recived from this where way too messy to be valid. However, when I showed the Values with Little Endian Byteorder my Coworker who needs the Values from the InputStream he pointed out the values I get printed are "too low" in the sense of usage. I´m asking now do you guys have any Idea for another approach reading 32 Bit Float Values in Java?

0 Answers0