當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。