本文整理了Java中okio.BufferedSource.readShortLe()
方法的一些代码示例,展示了BufferedSource.readShortLe()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BufferedSource.readShortLe()
方法的具体详情如下:
包路径:okio.BufferedSource
类名称:BufferedSource
方法名:readShortLe
[英]Removes two bytes from this source and returns a little-endian short.
[中]从该源中删除两个字节,并返回稍微短的endian。
代码示例来源:origin: square/okio
@Test public void readShortLe() throws Exception {
sink.write(new byte[] {
(byte) 0xab, (byte) 0xcd, (byte) 0xef, (byte) 0x10
});
sink.emit();
assertEquals((short) 0xcdab, source.readShortLe());
assertEquals((short) 0x10ef, source.readShortLe());
assertTrue(source.exhausted());
}
代码示例来源:origin: square/okio
@Test public void readShortLeTooShortThrows() throws IOException {
sink.writeShortLe(Short.MAX_VALUE);
sink.emit();
source.readByte();
try {
source.readShortLe();
fail();
} catch (EOFException expected) {
}
}
代码示例来源:origin: huxq17/tractor
checkEqual("FHCRC", source.readShortLe(), (short) crc.getValue());
crc.reset();
内容来源于网络,如有侵权,请联系作者删除!