本文整理汇总了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);
}
示例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]);
}
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例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);
}
}
示例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());
//}
}
示例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);
}
示例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());
}
示例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());
}
示例14: toBytes
import io.netty.buffer.ByteBuf; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(index);
}
示例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());
}