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

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

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

Buffer.getUnsignedInt介绍

[英]Returns the unsigned int at position pos in the Buffer, as a long.
[中]返回缓冲区中位置pos处的无符号整数,作为长整数。

代码示例

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

static Http2Settings decodeSettings(String base64Settings) {
 try {
  Http2Settings settings = new Http2Settings();
  Buffer buffer = Buffer.buffer(Base64.getUrlDecoder().decode(base64Settings));
  int pos = 0;
  int len = buffer.length();
  while (pos < len) {
   int i = buffer.getUnsignedShort(pos);
   pos += 2;
   long j = buffer.getUnsignedInt(pos);
   pos += 4;
   settings.put((char)i, (Long)j);
  }
  return settings;
 } catch (Exception ignore) {
 }
 return null;
}

代码示例来源: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: eclipse-vertx/vert.x

private void testSetUnsignedInt(Buffer buff) throws Exception {
 for (int i = 0; i < numSets; i++) {
  long val = Integer.toUnsignedLong(Integer.MAX_VALUE + i);
  buff.setUnsignedInt(i * 4, val);
 }
 for (int i = 0; i < numSets; i++) {
  long val = Integer.toUnsignedLong(Integer.MAX_VALUE + i);
  assertEquals(val, buff.getUnsignedInt(i * 4));
 }
}

代码示例来源: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: io.vertx/vertx-core

static Http2Settings decodeSettings(String base64Settings) {
 try {
  Http2Settings settings = new Http2Settings();
  Buffer buffer = Buffer.buffer(Base64.getUrlDecoder().decode(base64Settings));
  int pos = 0;
  int len = buffer.length();
  while (pos < len) {
   int i = buffer.getUnsignedShort(pos);
   pos += 2;
   long j = buffer.getUnsignedInt(pos);
   pos += 4;
   settings.put((char)i, (Long)j);
  }
  return settings;
 } catch (Exception ignore) {
 }
 return null;
}

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

private void testSetUnsignedInt(Buffer buff) throws Exception {
 for (int i = 0; i < numSets; i++) {
  long val = Integer.toUnsignedLong(Integer.MAX_VALUE + i);
  buff.setUnsignedInt(i * 4, val);
 }
 for (int i = 0; i < numSets; i++) {
  long val = Integer.toUnsignedLong(Integer.MAX_VALUE + i);
  assertEquals(val, buff.getUnsignedInt(i * 4));
 }
}

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

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

代码示例来源: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>.
 * @param pos 
 * @return 
 */
public long getUnsignedInt(int pos) { 
 long ret = delegate.getUnsignedInt(pos);
 return ret;
}

代码示例来源:origin: com.jukusoft/vertx-binary-serializer

int length = (int) msg.getUnsignedInt(_pos);
_pos += 4;

相关文章