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

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

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

Buffer.getUnsignedIntLE介绍

[英]Returns the unsigned int at position pos in the Buffer, as a long in Little Endian Byte Order.
[中]返回缓冲区中位置pos处的无符号整数,以小尾数字节顺序表示。

代码示例

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

private void testGetSetUnsignedInt(boolean isLE) throws Exception {
 int numInts = 100;
 Buffer b = Buffer.buffer(numInts * 4);
 for (int i = 0; i < numInts; i++) {
  if (isLE) {
   b.setUnsignedIntLE(i * 4, (int) (Integer.MAX_VALUE + (long) i));
  } else {
   b.setUnsignedInt(i * 4, (int) (Integer.MAX_VALUE + (long) i));
  }
 }
 for (int i = 0; i < numInts; i++) {
  if (isLE) {
   assertEquals(Integer.toUnsignedLong(Integer.MAX_VALUE + i), b.getUnsignedIntLE(i * 4));
  } else {
   assertEquals(Integer.toUnsignedLong(Integer.MAX_VALUE + i), b.getUnsignedInt(i * 4));
  }
 }
}

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

/**
 * Returns the unsigned <code>int</code> at position <code>pos</code> in the Buffer, as a <code>long</code> in Little Endian Byte Order.
 * @param pos 
 * @return 
 */
public long getUnsignedIntLE(int pos) { 
 long ret = delegate.getUnsignedIntLE(pos);
 return ret;
}

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

/**
 * Returns the unsigned <code>int</code> at position <code>pos</code> in the Buffer, as a <code>long</code> in Little Endian Byte Order.
 * @param pos 
 * @return 
 */
public long getUnsignedIntLE(int pos) { 
 long ret = delegate.getUnsignedIntLE(pos);
 return ret;
}

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

private void testGetSetUnsignedInt(boolean isLE) throws Exception {
 int numInts = 100;
 Buffer b = Buffer.buffer(numInts * 4);
 for (int i = 0; i < numInts; i++) {
  if (isLE) {
   b.setUnsignedIntLE(i * 4, (int) (Integer.MAX_VALUE + (long) i));
  } else {
   b.setUnsignedInt(i * 4, (int) (Integer.MAX_VALUE + (long) i));
  }
 }
 for (int i = 0; i < numInts; i++) {
  if (isLE) {
   assertEquals(Integer.toUnsignedLong(Integer.MAX_VALUE + i), b.getUnsignedIntLE(i * 4));
  } else {
   assertEquals(Integer.toUnsignedLong(Integer.MAX_VALUE + i), b.getUnsignedInt(i * 4));
  }
 }
}

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

/**
 * Try to parse the trailer and call {@link #endHandler} if successful
 */
private void tryParseTrailer() {
 if (trailerBuffer.length() < 8) {
  // wait for more data
  return;
 }
 long v = trailerBuffer.getUnsignedIntLE(0);
 long bytesWritten = trailerBuffer.getUnsignedIntLE(4);
 if (v != crc.getValue() || bytesWritten != (inflater.getBytesWritten() & 0xffffffffL)) {
  handleException(new ZipException("Corrupt GZIP trailer"));
  return;
 }
 if (endHandler != null) {
  endHandler.handle(null);
 }
}

相关文章

微信公众号

最新文章

更多