readFloatLe

Removes four bytes from this source and returns a floating point number with type Float composed of it according to the little-endian order.

The Float.Companion.fromBits function is used for decoding bytes into Float.

Note that in Kotlin/JS a value obtained by writing an original Float value to a Sink using Sink.writeFloatLe and then reading it back using Source.readFloatLe may not be equal to the original value. Please refer to Float.Companion.fromBits documentation for details.

Throws

when there are not enough data to read an unsigned int value.

when the source is closed.

when some I/O error occurs.

Samples

import kotlinx.io.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   val buffer = Buffer()
buffer.write(byteArrayOf(-74, -26, 64, 70))
assertEquals(12345.678F.toBits(), buffer.readFloatLe().toBits()) 
   //sampleEnd
}