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

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

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

Buffer.setDouble介绍

[英]Sets the double at position pos in the Buffer to the value d.

The buffer will expand as necessary to accommodate any value written.
[中]将缓冲区中的double at pos位置设置为值d。
缓冲区将根据需要扩展以容纳任何写入的值。

代码示例

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

private void testSetDouble(Buffer buff) throws Exception {
 for (int i = 0; i < numSets; i++) {
  buff.setDouble(i * 8, (double) i);
 }
 for (int i = 0; i < numSets; i++) {
  assertEquals((double) i, buff.getDouble(i * 8), 0);
 }
}

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

@Test
public void testGetDouble() throws Exception {
 int numDoubles = 100;
 Buffer b = Buffer.buffer(numDoubles * 8);
 for (int i = 0; i < numDoubles; i++) {
  b.setDouble(i * 8, i);
 }
 for (int i = 0; i < numDoubles; i++) {
  assertEquals((double) i, b.getDouble(i * 8), 0);
 }
}

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

@Test
public void testSetOutOfBounds() throws Exception {
 Buffer b = Buffer.buffer(numSets);
 assertIndexOutOfBoundsException(() -> b.setByte(-1, (byte) 0));
 assertIndexOutOfBoundsException(() -> b.setInt(-1, 0));
 assertIndexOutOfBoundsException(() -> b.setLong(-1, 0));
 assertIndexOutOfBoundsException(() -> b.setDouble(-1, 0));
 assertIndexOutOfBoundsException(() -> b.setFloat(-1, 0));
 assertIndexOutOfBoundsException(() -> b.setShort(-1, (short) 0));
 assertIndexOutOfBoundsException(() -> b.setBuffer(-1, b));
 assertIndexOutOfBoundsException(() -> b.setBuffer(0, b, -1, 0));
 assertIndexOutOfBoundsException(() -> b.setBuffer(0, b, 0, -1));
 assertIndexOutOfBoundsException(() -> b.setBytes(-1, TestUtils.randomByteArray(1)));
 assertIndexOutOfBoundsException(() -> b.setBytes(-1, TestUtils.randomByteArray(1), -1, 0));
 assertIndexOutOfBoundsException(() -> b.setBytes(-1, TestUtils.randomByteArray(1), 0, -1));
 assertIndexOutOfBoundsException(() -> b.setString(-1, ""));
 assertIndexOutOfBoundsException(() -> b.setString(-1, "", "UTF-8"));
}

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

private void testSetDouble(Buffer buff) throws Exception {
 for (int i = 0; i < numSets; i++) {
  buff.setDouble(i * 8, (double) i);
 }
 for (int i = 0; i < numSets; i++) {
  assertEquals((double) i, buff.getDouble(i * 8), 0);
 }
}

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

@Test
public void testGetDouble() throws Exception {
 int numDoubles = 100;
 Buffer b = Buffer.buffer(numDoubles * 8);
 for (int i = 0; i < numDoubles; i++) {
  b.setDouble(i * 8, i);
 }
 for (int i = 0; i < numDoubles; i++) {
  assertEquals((double) i, b.getDouble(i * 8), 0);
 }
}

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

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

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

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

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

@Test
public void testSetOutOfBounds() throws Exception {
 Buffer b = Buffer.buffer(numSets);
 assertIndexOutOfBoundsException(() -> b.setByte(-1, (byte) 0));
 assertIndexOutOfBoundsException(() -> b.setInt(-1, 0));
 assertIndexOutOfBoundsException(() -> b.setLong(-1, 0));
 assertIndexOutOfBoundsException(() -> b.setDouble(-1, 0));
 assertIndexOutOfBoundsException(() -> b.setFloat(-1, 0));
 assertIndexOutOfBoundsException(() -> b.setShort(-1, (short) 0));
 assertIndexOutOfBoundsException(() -> b.setBuffer(-1, b));
 assertIndexOutOfBoundsException(() -> b.setBuffer(0, b, -1, 0));
 assertIndexOutOfBoundsException(() -> b.setBuffer(0, b, 0, -1));
 assertIndexOutOfBoundsException(() -> b.setBytes(-1, TestUtils.randomByteArray(1)));
 assertIndexOutOfBoundsException(() -> b.setBytes(-1, TestUtils.randomByteArray(1), -1, 0));
 assertIndexOutOfBoundsException(() -> b.setBytes(-1, TestUtils.randomByteArray(1), 0, -1));
 assertIndexOutOfBoundsException(() -> b.setString(-1, ""));
 assertIndexOutOfBoundsException(() -> b.setString(-1, "", "UTF-8"));
}

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

buf.setDouble(_pos, d);
  _pos += 8;
} else if (clazz == SBuffer.class) {

相关文章