okio.BufferedSource.readShortLe()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.0k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中okio.BufferedSource.readShortLe()方法的一些代码示例,展示了BufferedSource.readShortLe()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BufferedSource.readShortLe()方法的具体详情如下:
包路径:okio.BufferedSource
类名称:BufferedSource
方法名:readShortLe

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();

相关文章

微信公众号

最新文章

更多