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


Java ByteBuf.writeInt方法代码示例

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


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

示例1: testUpdateIntSparseToIntSparse

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

示例2: serialize

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void serialize(ByteBuf buf) {
  super.serialize(buf);
  buf.writeInt(end - start);
  LOG.debug("int size = " + (end - start));
  for (int i = start; i < end; i++) {
    buf.writeInt(offsets[i]);
    buf.writeInt(values[i]);
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:11,代码来源:SparseIntRowUpdateSplit.java

示例3: testUpdate

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Test
public void testUpdate() throws Exception {
  serverDenseDoubleRow = new ServerDenseDoubleRow(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) + serverDenseDoubleRow.getData().get(0);
  double newValue1 = buf.getDouble(8) + serverDenseDoubleRow.getData().get(1);
  serverDenseDoubleRow.update(RowType.T_DOUBLE_DENSE, buf, 3);
  assertEquals(serverDenseDoubleRow.getData().get(0), newValue0, 0.000);
  assertEquals(serverDenseDoubleRow.getData().get(1), newValue1, 0.000);
  assertEquals(serverDenseDoubleRow.getData().get(2), -1, 0.000);

  serverDenseDoubleRow = new ServerDenseDoubleRow(rowId, startCol, endCol);
  buf = Unpooled.buffer(0);
  LOG.info(buf);
  buf.writeInt(0);
  buf.writeDouble(1.00);
  buf.writeInt(2);
  buf.writeDouble(-2.00);
  serverDenseDoubleRow.update(RowType.T_DOUBLE_SPARSE, buf, 2);
  assertEquals(serverDenseDoubleRow.getData().get(0), 1, 0.000);
  assertEquals(serverDenseDoubleRow.getData().get(1), 0, 0.000);
  assertEquals(serverDenseDoubleRow.getData().get(2), -2, 0.000);

}
 
开发者ID:Tencent,项目名称:angel,代码行数:29,代码来源:ServerDenseDoubleRowTest.java

示例4: toBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
    buf.writeLong(selectedBlock.toLong());
    buf.writeByte(selectedSide.ordinal());
    NetworkTools.writeStringUTF8(buf, destination.getName());
    buf.writeInt(destination.getDimension());
    buf.writeLong(destination.getPos().toLong());
    buf.writeByte(destination.getSide().ordinal());
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:10,代码来源:PacketMakePortals.java

示例5: toBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
	
	buf.writeShort(type.ordinal());
	buf.writeDouble(x);
	buf.writeDouble(y);
	buf.writeDouble(z);
	buf.writeInt(loopSize);
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:10,代码来源:PacketUCEffect.java

示例6: toBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
	buf.writeInt(dimID);
	buf.writeInt(standID);
	buf.writeInt(playerID);
	buf.writeDouble(hitPos.xCoord);
	buf.writeDouble(hitPos.yCoord);
	buf.writeDouble(hitPos.zCoord);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:10,代码来源:ArmourStandInteractMessage.java

示例7: toBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
    
    buf.writeInt(this.x);
    buf.writeInt(this.y);
    buf.writeInt(this.z);
    
    buf.writeByte(this.state);
    
    buf.writeInt(this.needCycleTime);
    buf.writeInt(this.itemCycleTime);
    buf.writeInt(this.deviceCycleTime);
    buf.writeLong(this.energy);
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:15,代码来源:MessageMachineBase.java

示例8: toBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
	PacketBuffer beef = new PacketBuffer(buf);
	try {
		buf.writeInt(PacketHandler.HANDLERS.indexOf(handler));
		beef.writeCompoundTag(data);
	} catch(Exception e) {
		Solar.LOG.error("[Packet] Failed to send packet");
		e.printStackTrace();
	}
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:12,代码来源:ServerToClientPacket.java

示例9: toBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
    NetworkTools.writePos(buf, pos);
    buf.writeInt(integers.length);
    for (int i : integers) {
        buf.writeInt(i);
    }
}
 
开发者ID:McJty,项目名称:needtobreath,代码行数:9,代码来源:PacketIntegersFromServer.java

示例10: serialize

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void serialize(ByteBuf buf) {
  super.serialize(buf);
  buf.writeBoolean(comeFromPs);
  buf.writeInt(clock);
  partKey.serialize(buf);
  //if(comeFromPs) {
  //  buf.writeInt(psId.getIndex());
  //  byte[] data = location.getIp().getBytes();
  //  buf.writeInt(data.length);
  //  buf.writeBytes(data);
  //  buf.writeInt(location.getPort());
  //}
}
 
开发者ID:Tencent,项目名称:angel,代码行数:15,代码来源:PartitionRequest.java

示例11: toBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
void toBytes(ByteBuf bytes)
{
    bytes.writeInt(this.dimensionId);
    byte[] data = this.providerId.getBytes(Charsets.UTF_8);
    bytes.writeShort(data.length);
    bytes.writeBytes(data);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:ForgeMessage.java

示例12: toBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
    ByteBufUtils.writeUTF8String(buf, varName);
    buf.writeInt(value.getX());
    buf.writeInt(value.getY());
    buf.writeInt(value.getZ());
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:PacketSetGlobalVariable.java

示例13: func_145757_a

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
public void func_145757_a(ByteBuf p_145757_1_)
{
    p_145757_1_.writeInt(TileEntityCommandBlock.this.pos.getX());
    p_145757_1_.writeInt(TileEntityCommandBlock.this.pos.getY());
    p_145757_1_.writeInt(TileEntityCommandBlock.this.pos.getZ());
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:7,代码来源:TileEntityCommandBlock.java

示例14: toBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
	buf.writeInt(index);
}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:5,代码来源:PacketSetSelectedItem.java

示例15: toBytes

import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
	buf.writeInt(type.ordinal());
	buf.writeInt(imagename.length());
	buf.writeBytes(imagename.getBytes());
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:7,代码来源:MessageFailLoadImage.java


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