@Test public void writeShortLe() throws Exception { sink.writeShortLe(0xcdab); sink.writeShortLe(0x2143); sink.flush(); assertEquals("[hex=abcd4321]", data.toString()); }
sink.writeShortLe(0); // Unused. sink.writeShortLe(0); // Unused. sink.writeIntLe(width); sink.writeIntLe(height); sink.writeShortLe(1); // Color plane count. sink.writeShortLe(bytesPerPixel * Byte.SIZE); sink.writeIntLe(0); // No compression. sink.writeIntLe(16); // Size of bitmap data including padding.
@Test public void readShortLeTooShortThrows() throws IOException { sink.writeShortLe(Short.MAX_VALUE); sink.emit(); source.readByte(); try { source.readShortLe(); fail(); } catch (EOFException expected) { } }