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

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

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

Buffer.setShortLE介绍

[英]Sets the short at position pos in the Buffer to the value s in the Little Endian Byte Order.

The buffer will expand as necessary to accommodate any value written.
[中]将缓冲区中位置pos处的短路设置为小端字节顺序的值s。
缓冲区将根据需要扩展以容纳任何写入的值。

代码示例

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

private void testGetSetShort(boolean isLE) throws Exception {
 int numShorts = 100;
 Buffer b = Buffer.buffer(numShorts * 2);
 for (short i = 0; i < numShorts; i++) {
  if (isLE) {
   b.setShortLE(i * 2, i);
  } else {
   b.setShort(i * 2, i);
  }
 }
 for (short i = 0; i < numShorts; i++) {
  if (isLE) {
   assertEquals(i, b.getShortLE(i * 2));
  } else {
   assertEquals(i, b.getShort(i * 2));
  }
 }
}

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

/**
 * Sets the <code>short</code> at position <code>pos</code> in the Buffer to the value <code>s</code> in the Little Endian Byte Order.<p>
 * The buffer will expand as necessary to accommodate any value written.
 * @param pos 
 * @param s 
 * @return 
 */
public io.vertx.rxjava.core.buffer.Buffer setShortLE(int pos, short s) { 
 delegate.setShortLE(pos, s);
 return this;
}

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

/**
 * Sets the <code>short</code> at position <code>pos</code> in the Buffer to the value <code>s</code> in the Little Endian Byte Order.<p>
 * The buffer will expand as necessary to accommodate any value written.
 * @param pos 
 * @param s 
 * @return 
 */
public io.vertx.rxjava.core.buffer.Buffer setShortLE(int pos, short s) { 
 delegate.setShortLE(pos, s);
 return this;
}

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

private void testGetSetShort(boolean isLE) throws Exception {
 int numShorts = 100;
 Buffer b = Buffer.buffer(numShorts * 2);
 for (short i = 0; i < numShorts; i++) {
  if (isLE) {
   b.setShortLE(i * 2, i);
  } else {
   b.setShort(i * 2, i);
  }
 }
 for (short i = 0; i < numShorts; i++) {
  if (isLE) {
   assertEquals(i, b.getShortLE(i * 2));
  } else {
   assertEquals(i, b.getShort(i * 2));
  }
 }
}

相关文章