Skip to content

okio / okio / BufferedSink / writeShortLe

writeShortLe

(js, jvm, native) abstract fun writeShortLe(s:Int):BufferedSink

Writes a little-endian short to this sink using two bytes.

Buffer buffer = new Buffer();
buffer.writeShortLe(32767);
buffer.writeShortLe(15);

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