List of usage examples for io.netty.buffer ByteBuf writeLong
public abstract ByteBuf writeLong(long value);
From source file:ivorius.ivtoolkit.tools.IvNBTHelper.java
License:Apache License
public static void writeNBTLongs(String id, long[] longs, NBTTagCompound compound) { if (longs != null) { ByteBuf bytes = Unpooled.buffer(longs.length * 8); for (long aLong : longs) bytes.writeLong(aLong); compound.setByteArray(id, bytes.array()); }//from www . j a v a 2s .c o m }
From source file:jayavery.geomastery.packets.CPacketContainer.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { buf.writeInt(this.slot); ByteBufUtils.writeItemStack(buf, this.stack); buf.writeLong(this.birthTime); }
From source file:matteroverdrive.network.packet.bi.PacketWeaponTick.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { buf.writeLong(timestamp); buf.writeBoolean(plasmaShot != null); if (plasmaShot != null) { plasmaShot.toBytes(buf);/*from w w w. jav a2s . c om*/ } }
From source file:matteroverdrive.starmap.data.TravelEvent.java
License:Open Source License
public void writeToBuffer(ByteBuf buf) { from.writeToBuffer(buf);// www. j ava2 s . c o m to.writeToBuffer(buf); ByteBufUtils.writeItemStack(buf, ship); buf.writeInt(timeLength); buf.writeLong(timeStart); }
From source file:me.bigteddy98.movingmotd.PacketBuilder.java
License:Open Source License
public static ByteBuf buildPingTime(long time) { ByteBuf newBuf = Unpooled.buffer(); PacketUtils.writeVarInt(newBuf, 0x01); newBuf.writeLong(time); return wrapSize(newBuf); }
From source file:nenea.client.operation.OperationClientHandler.java
License:Apache License
private ByteBuf initializeProtocol(String msg, Channel ch) throws UnsupportedEncodingException { System.out.println("make JOIN Header"); ByteBuf buf = ch.alloc().heapBuffer(OP_CODE_JOIN.length() + 12 + msg.getBytes("UTF-8").length); buf.writeInt(OP_CODE_JOIN.length()); buf.writeBytes(OP_CODE_JOIN.getBytes()); buf.writeLong(msg.getBytes("UTF-8").length); buf.writeBytes(msg.getBytes("UTF-8")); System.out.println("buffer index : " + buf.writerIndex()); System.out.println("hex : " + ByteBufUtil.hexDump(buf)); return buf;//from w w w . j a va2 s.co m }
From source file:net.doubledoordev.inventorylock.network.Reply.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { buf.writeLong(key.toLong()); buf.writeInt(value.size());// www . j a va 2 s . co m for (String name : value) ByteBufUtils.writeUTF8String(buf, name); buf.writeBoolean(pub); }
From source file:net.doubledoordev.inventorylock.network.Request.java
License:Open Source License
@Override public void toBytes(ByteBuf buf) { buf.writeLong(key.toLong()); }
From source file:net.hasor.rsf.protocol.rsf.v1.RpcRequestProtocolV1.java
License:Apache License
/**encode Message to byte & write to network framework*/ public void encode(RequestBlock reqMsg, ByteBuf buf) throws IOException { //* --------------------------------------------------------bytes =13 //* byte[1] version RSF buf.writeByte(reqMsg.getHead());//w w w . j av a 2 s .c o m //* byte[8] requestID ID buf.writeLong(reqMsg.getRequestID()); //* byte[1] keepData ? buf.writeByte(0); //* byte[3] contentLength ?(max = 16MB) ByteBuf requestBody = this.encodeRequest(reqMsg); int bodyLength = requestBody.readableBytes(); bodyLength = (bodyLength << 8) >>> 8;//8??8??16777215? buf.writeMedium(bodyLength); // buf.writeBytes(requestBody); }
From source file:net.hasor.rsf.protocol.rsf.v1.RpcResponseProtocolV1.java
License:Apache License
/**encode Message to byte & write to network framework*/ public void encode(ResponseBlock resMsg, ByteBuf buf) throws IOException { ///* w ww .ja v a 2s .c om*/ //* --------------------------------------------------------bytes =13 //* byte[1] version RSF(0x81) buf.writeByte(resMsg.getHead()); //* byte[8] requestID ID buf.writeLong(resMsg.getRequestID()); //* byte[1] keepData ? buf.writeByte(0); //* byte[3] contentLength ?(max = 16MB) ByteBuf responseBody = this.encodeResponse(resMsg); int bodyLength = responseBody.readableBytes(); bodyLength = (bodyLength << 8) >>> 8;//8??8??16777215? buf.writeMedium(bodyLength); // buf.writeBytes(responseBody); // }