io.vertx.core.buffer.Buffer.getUnsignedShortLE()方法的使用及代码示例

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

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

Buffer.getUnsignedShortLE介绍

[英]Gets an unsigned 16-bit short integer at the specified absolute index in this buffer in Little Endian Byte Order.
[中]获取此缓冲区中指定绝对索引处的无符号16位短整数(以小尾数字节顺序)。

代码示例

代码示例来源:origin: eclipse-vertx/vert.x

private void testGetSetUnsignedShort(boolean isLE) throws Exception {
 int numShorts = 100;
 Buffer b = Buffer.buffer(numShorts * 2);
 for (short i = 0; i < numShorts; i++) {
  if (isLE) {
   b.setUnsignedShortLE(i * 2, (short) (Short.MAX_VALUE + (int) i));
  } else {
   b.setUnsignedShort(i * 2, (short) (Short.MAX_VALUE + (int) i));
  }
 }
 for (short i = 0; i < numShorts; i++) {
  if (isLE) {
   assertEquals(Integer.toUnsignedLong(Short.MAX_VALUE + i), b.getUnsignedShortLE(i * 2));
  } else {
   assertEquals(Integer.toUnsignedLong(Short.MAX_VALUE + i), b.getUnsignedShort(i * 2));
  }
 }
}

代码示例来源:origin: io.vertx/vertx-rx-java

/**
 * Gets an unsigned 16-bit short integer at the specified absolute <code>index</code> in this buffer in Little Endian Byte Order.
 * @param pos 
 * @return 
 */
public int getUnsignedShortLE(int pos) { 
 int ret = delegate.getUnsignedShortLE(pos);
 return ret;
}

代码示例来源:origin: vert-x3/vertx-rx

/**
 * Gets an unsigned 16-bit short integer at the specified absolute <code>index</code> in this buffer in Little Endian Byte Order.
 * @param pos 
 * @return 
 */
public int getUnsignedShortLE(int pos) { 
 int ret = delegate.getUnsignedShortLE(pos);
 return ret;
}

代码示例来源:origin: io.vertx/vertx-core

private void testGetSetUnsignedShort(boolean isLE) throws Exception {
 int numShorts = 100;
 Buffer b = Buffer.buffer(numShorts * 2);
 for (short i = 0; i < numShorts; i++) {
  if (isLE) {
   b.setUnsignedShortLE(i * 2, (short) (Short.MAX_VALUE + (int) i));
  } else {
   b.setUnsignedShort(i * 2, (short) (Short.MAX_VALUE + (int) i));
  }
 }
 for (short i = 0; i < numShorts; i++) {
  if (isLE) {
   assertEquals(Integer.toUnsignedLong(Short.MAX_VALUE + i), b.getUnsignedShortLE(i * 2));
  } else {
   assertEquals(Integer.toUnsignedLong(Short.MAX_VALUE + i), b.getUnsignedShort(i * 2));
  }
 }
}

代码示例来源:origin: georocket/georocket

if (buf.getUnsignedShortLE(0) != GZIPInputStream.GZIP_MAGIC) {
 handleException(new ZipException("Not in GZIP format"));
 return 0;
  return 0;
 int m = buf.getUnsignedShortLE(n);
 n += m + 2;
 crc.update(buf.getBytes(0, n));
 int v = (int)crc.getValue() & 0xffff;
 if (buf.getUnsignedShortLE(n) != v) {
  handleException(new ZipException("Corrupt GZIP header"));
  return 0;

相关文章

微信公众号

最新文章

更多