Skip to content

okio / okio / BufferedSink / writeIntLe

writeIntLe

(js, jvm, native) abstract fun writeIntLe(i:Int):BufferedSink

Writes a little-endian int to this sink using four bytes.

Buffer buffer = new Buffer();
buffer.writeIntLe(2147483647);
buffer.writeIntLe(15);

assertEquals(8, buffer.size());
assertEquals((byte) 0xff, buffer.readByte());
assertEquals((byte) 0xff, buffer.readByte());
assertEquals((byte) 0xff, buffer.readByte());
assertEquals((byte) 0x7f, buffer.readByte());
assertEquals((byte) 0x0f, buffer.readByte());
assertEquals((byte) 0x00, buffer.readByte());
assertEquals((byte) 0x00, buffer.readByte());
assertEquals((byte) 0x00, buffer.readByte());
assertEquals(0, buffer.size());