当前位置: 首页>>代码示例>>Java>>正文


Java ByteBuf.writeDouble方法代码示例

本文整理汇总了Java中io.netty.buffer.ByteBuf.writeDouble方法的典型用法代码示例。如果您正苦于以下问题:Java ByteBuf.writeDouble方法的具体用法?Java ByteBuf.writeDouble怎么用?Java ByteBuf.writeDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.netty.buffer.ByteBuf的用法示例。


在下文中一共展示了ByteBuf.writeDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serialize

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void serialize(ByteBuf buf) {
  int rows = result.length;
  int cols = result[0].length;

  buf.writeInt(rows);
  buf.writeInt(cols);
  for (int i = 0; i < rows; i++) {
    for (int j = 0; j < cols; j++) {
      buf.writeDouble(result[i][j]);
    }
  }

  buf.writeInt(partInfo.length);
  for (int i = 0; i < partInfo.length; i++) {
    buf.writeInt(partInfo[i]);
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:19,代码来源:FullPartitionAggrResult.java

示例2: testUpdate

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Test
public void testUpdate() throws Exception {
  serverSparseDoubleRow = new ServerSparseDoubleRow(rowId, startCol, endCol);
  ByteBuf buf = Unpooled.buffer(16);
  buf.writeDouble(0.00);
  buf.writeDouble(1.00);
  buf.writeDouble(-1.00);
  double newValue0 = buf.getDouble(0) + serverSparseDoubleRow.getData().get(0);
  double newValue1 = buf.getDouble(8) + serverSparseDoubleRow.getData().get(1);
  serverSparseDoubleRow.update(RowType.T_DOUBLE_DENSE, buf, 3);
  assertEquals(serverSparseDoubleRow.getData().get(0), newValue0, 0.000);
  assertEquals(serverSparseDoubleRow.getData().get(1), newValue1, 0.000);
  assertEquals(serverSparseDoubleRow.getData().get(2), -1, 0.000);

  serverSparseDoubleRow = new ServerSparseDoubleRow(rowId, startCol, endCol);
  buf = Unpooled.buffer(0);
  LOG.info(buf);
  buf.writeInt(0);
  buf.writeDouble(1.00);
  buf.writeInt(2);
  buf.writeDouble(-2.00);
  serverSparseDoubleRow.update(RowType.T_DOUBLE_SPARSE, buf, 2);
  assertEquals(serverSparseDoubleRow.getData().get(0), 1, 0.000);
  assertEquals(serverSparseDoubleRow.getData().get(1), 0, 0.000);
  assertEquals(serverSparseDoubleRow.getData().get(2), -2, 0.000);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:27,代码来源:ServerSparseDoubleRowTest.java

示例3: testUpdateDoubleSparseToDoubleSparse

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Test
public void testUpdateDoubleSparseToDoubleSparse() throws Exception {
  ServerSparseDoubleRow serverSparseDoubleRow =
      new ServerSparseDoubleRow(rowId, startCol, endCol);
  ByteBuf buf = Unpooled.buffer(16);
  buf.writeInt(0);
  buf.writeDouble(0.00);
  buf.writeInt(1);
  buf.writeDouble(1.00);
  buf.writeInt(2);
  buf.writeDouble(2.00);
  rowUpdater.updateDoubleSparseToDoubleSparse(3, buf, serverSparseDoubleRow);
  Int2DoubleOpenHashMap hashMap = new Int2DoubleOpenHashMap();
  hashMap.addTo(0, 0.00);
  hashMap.addTo(1, 1.00);
  hashMap.addTo(2, 2.00);
  assertEquals(serverSparseDoubleRow.getData(), hashMap);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:19,代码来源:DefaultRowUpdaterTest.java

示例4: serialize

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void serialize(ByteBuf buf) {
  try {
    lock.readLock().lock();
    super.serialize(buf);
    buf.writeInt(index2ValueMap.size());

    ObjectIterator<Long2DoubleMap.Entry> iter = index2ValueMap.long2DoubleEntrySet().fastIterator();
    Long2DoubleMap.Entry entry = null;
    while (iter.hasNext()) {
      entry = iter.next();
      buf.writeLong(entry.getLongKey());
      buf.writeDouble(entry.getDoubleValue());
    }
  } finally {
    lock.readLock().unlock();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:19,代码来源:ServerSparseDoubleLongKeyRow.java

示例5: testDeserialize

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Test
public void testDeserialize() throws Exception {
  ByteBuf buf = Unpooled.buffer(16);
  buf.writeInt(0);
  buf.writeInt(1);
  buf.writeLong(2);
  buf.writeLong(3);
  buf.writeInt(4);
  buf.writeInt(3);
  buf.writeDouble(-1.0);
  buf.writeDouble(-2.0);
  buf.writeDouble(-3.0);
  serverDenseDoubleRow.deserialize(buf);
  assertEquals(serverDenseDoubleRow.getRowId(), 0);
  assertEquals(serverDenseDoubleRow.getClock(), 1);
  assertEquals(serverDenseDoubleRow.getStartCol(), 2);
  assertEquals(serverDenseDoubleRow.getEndCol(), 3);
  assertEquals(serverDenseDoubleRow.getRowVersion(), 4);
  assertEquals(serverDenseDoubleRow.getData().get(0), -1, 0.0);
  assertEquals(serverDenseDoubleRow.getData().get(1), -2, 0.0);
  assertEquals(serverDenseDoubleRow.getData().get(2), -3, 0.0);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:23,代码来源:ServerDenseDoubleRowTest.java

示例6: testWriteTo

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Test
public void testWriteTo() throws Exception {
  ByteBuf buf = Unpooled.buffer(16);
  buf.writeDouble(0.00);
  buf.writeDouble(1.00);
  buf.writeDouble(2.00);
  serverDenseDoubleRow.update(RowType.T_DOUBLE_DENSE, buf, 3);
  DataOutputStream out = new DataOutputStream(new FileOutputStream("data"));
  serverDenseDoubleRow.writeTo(out);
  out.close();
  DataInputStream in = new DataInputStream(new FileInputStream("data"));
  assertEquals(in.readDouble(), 0, 0.00);
  assertEquals(in.readDouble(), 1, 0.00);
  assertEquals(in.readDouble(), 2, 0.00);
  in.close();
}
 
开发者ID:Tencent,项目名称:angel,代码行数:17,代码来源:ServerDenseDoubleRowTest.java

示例7: testReadFrom

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Test
public void testReadFrom() throws Exception {
  ByteBuf buf = Unpooled.buffer(16);
  buf.writeDouble(10.00);
  buf.writeDouble(11.00);
  buf.writeDouble(12.00);
  serverDenseDoubleRow.update(RowType.T_DOUBLE_DENSE, buf, 3);
  DataOutputStream out = new DataOutputStream(new FileOutputStream("data"));
  serverDenseDoubleRow.writeTo(out);
  out.close();
  DataInputStream in = new DataInputStream(new FileInputStream("data"));
  ServerDenseDoubleRow newServerDenseDoubleRow =
      new ServerDenseDoubleRow(rowId, startCol, endCol);
  newServerDenseDoubleRow.readFrom(in);
  in.close();
  assertEquals(newServerDenseDoubleRow.getData().get(0), serverDenseDoubleRow.getData().get(0),
      0.00);
  assertEquals(newServerDenseDoubleRow.getData().get(1), serverDenseDoubleRow.getData().get(1),
      0.00);
  assertEquals(newServerDenseDoubleRow.getData().get(2), serverDenseDoubleRow.getData().get(2),
      0.00);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:23,代码来源:ServerDenseDoubleRowTest.java

示例8: write

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void write( ByteBuf buf ) throws IOException {
    writeVarInt( entityId, buf );
    writeUUID( uuid, buf );
    buf.writeByte( type );
    buf.writeDouble( x );
    buf.writeDouble( y );
    buf.writeDouble( z );
    buf.writeByte( toAngle( yaw ) );
    buf.writeByte( toAngle( pitch ) );
    buf.writeInt( 1 );
    buf.writeShort( 1 );
    buf.writeShort( 1 );
    buf.writeShort( 1 );
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:16,代码来源:MessageS00SpawnObject.java

示例9: serialize

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void serialize(ByteBuf buf) {
  super.serialize(buf);
  buf.writeInt(values.length);
  for (double value : values) {
    buf.writeDouble(value);
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:9,代码来源:FullUpdateParam.java

示例10: toBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf)
{
    buf.writeDouble(this.x);
    buf.writeDouble(this.y);
    buf.writeDouble(this.z);
    buf.writeFloat(this.yaw);
    buf.writeFloat(this.pitch);

    buf.writeBoolean(this.setX);
    buf.writeBoolean(this.setY);
    buf.writeBoolean(this.setZ);
    buf.writeBoolean(this.setYaw);
    buf.writeBoolean(this.setPitch);
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:16,代码来源:AbsoluteMovementCommandsImplementation.java

示例11: writeSpawnData

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void writeSpawnData(ByteBuf buffer) 			// save extra data on the server
   {
	buffer.writeDouble(this.ownerX);
	buffer.writeDouble(this.ownerY);
	buffer.writeDouble(this.ownerZ);
   }
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:8,代码来源:EnderAccelerator.java

示例12: testBufferLen

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Test
public void testBufferLen() throws Exception {
  ByteBuf buf = Unpooled.buffer(16);
  serverSparseDoubleRow.setClock(8);
  buf.writeDouble(0.00);
  buf.writeDouble(1.00);
  buf.writeDouble(-1.00);
  serverSparseDoubleRow.update(RowType.T_DOUBLE_DENSE, buf, 3);
  assertEquals(serverSparseDoubleRow.bufferLen(), 20 + 4 + 3 * 12);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:11,代码来源:ServerSparseDoubleRowTest.java

示例13: writeSpawnData

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void writeSpawnData(ByteBuf buffer) {
    buffer.writeDouble(faerieInformation.getMaxHealth());
    buffer.writeFloat(faerieInformation.getSize());
    buffer.writeInt(faerieInformation.getType());
    buffer.writeInt(faerieInformation.getLevel());
    buffer.writeInt(faerieInformation.getCurrentExp());
}
 
开发者ID:BenjaminSutter,项目名称:genera,代码行数:9,代码来源:EntityFaerie.java

示例14: write

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void write( ByteBuf buf ) throws IOException {
    writeVarInt( entityId, buf );
    buf.writeDouble( x );
    buf.writeDouble( y );
    buf.writeDouble( z );
    buf.writeByte( toAngle( yaw ) );
    buf.writeByte( toAngle( pitch ) );
    buf.writeBoolean( onGround );
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:11,代码来源:MessageS4CEntityTeleport.java

示例15: testUpdateDoubleDenseToDoubleDense

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Test
public void testUpdateDoubleDenseToDoubleDense() throws Exception {
  ServerDenseDoubleRow serverDenseDoubleRow = new ServerDenseDoubleRow(rowId, startCol, endCol);
  ByteBuf buf = Unpooled.buffer(16);
  buf.writeDouble(0.00);
  buf.writeDouble(1.00);
  buf.writeDouble(-1.00);
  rowUpdater.updateDoubleDenseToDoubleDense(3, buf, serverDenseDoubleRow);
  assertEquals(serverDenseDoubleRow.getData().get(0), 0, 0.00);
  assertEquals(serverDenseDoubleRow.getData().get(1), 1, 0.00);
  assertEquals(serverDenseDoubleRow.getData().get(2), -1, 0.00);
}
 
开发者ID:Tencent,项目名称:angel,代码行数:13,代码来源:DefaultRowUpdaterTest.java


注:本文中的io.netty.buffer.ByteBuf.writeDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。