List of usage examples for com.google.common.io ByteArrayDataOutput writeInt
@Override void writeInt(int v);
From source file:eplus.network.packets.ConfigPacket.java
@Override public void write(ByteArrayDataOutput output) { output.writeInt(configSettings.size()); for (String key : configSettings.keySet()) { output.writeUTF(key);//from ww w . ja va2 s . co m output.writeUTF(configSettings.get(key)); } }
From source file:de.mineformers.robots.network.packet.PacketFactoryController.java
@Override public void write(ByteArrayDataOutput out) { super.write(out); out.writeInt(orientation); out.writeBoolean(validMultiblock);/*from w w w . jav a2s .c o m*/ out.writeUTF(selectedModule); }
From source file:com.freyja.FES.common.packets.PacketUpdateSettings.java
@Override protected void write(ByteArrayDataOutput output) { super.write(output); output.writeInt(settings); }
From source file:cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket.java
@Override public byte[] generatePacket(Object... data) { ByteArrayDataOutput dat = ByteStreams.newDataOutput(); dat.writeInt((Integer) data[0]); dat.writeInt((Integer) data[1]); dat.writeInt((Integer) data[2]); dat.writeInt((Integer) data[3]); return dat.toByteArray(); }
From source file:net.minecraftforge.common.network.packet.DimensionRegisterPacket.java
@Override public byte[] generatePacket() { ByteArrayDataOutput dat = ByteStreams.newDataOutput(); dat.writeInt(this.dimensionId); dat.writeInt(this.providerId); return dat.toByteArray(); }
From source file:shadowmage.ancient_framework.common.network.Packet00MultiPart.java
@Override public void writeDataToStream(ByteArrayDataOutput data) { data.writeInt(uniquePacketID); data.writeInt(sourcePacketType);/*from w ww.j a va 2 s.c om*/ data.writeInt(chunkNumber); data.writeInt(totalChunks); data.writeInt(startIndex); data.writeInt(chunkLength); data.writeInt(totalLength); data.write(datas); }
From source file:cpw.mods.fml.common.network.OpenGuiPacket.java
@Override public byte[] generatePacket(Object... data) { ByteArrayDataOutput dat = ByteStreams.newDataOutput(); dat.writeInt((Integer) data[0]); // windowId dat.writeInt((Integer) data[1]); // networkId dat.writeInt((Integer) data[2]); // modGuiId dat.writeInt((Integer) data[3]); // x dat.writeInt((Integer) data[4]); // y dat.writeInt((Integer) data[5]); // z return dat.toByteArray(); }
From source file:de.mineformers.robots.network.packet.PacketFactoryEnergy.java
@Override public void write(ByteArrayDataOutput out) { super.write(out); out.writeInt(energy); out.writeInt(currentRate);// w w w . j av a 2 s. co m out.writeBoolean(controllerPos != null); if (controllerPos != null) { out.writeInt((int) controllerPos.x); out.writeInt((int) controllerPos.y); out.writeInt((int) controllerPos.z); } }
From source file:eplus.network.packets.GuiPacket.java
@Override protected void write(ByteArrayDataOutput output) { output.writeUTF(username);/*from w w w . j a v a 2 s. com*/ output.writeInt(guiId); output.writeInt(xPos); output.writeInt(yPos); output.writeInt(zPos); }
From source file:org.elasticsoftware.elasticactors.cassandra.serialization.CompressingSerializer.java
@Override public byte[] serialize(I object) throws IOException { byte[] serializedObject = delegate.serialize(object); if (serializedObject.length > compressionThreshold) { byte[] compressedBytes = lz4Compressor.compress(serializedObject); ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput(compressedBytes.length + 8); dataOutput.write(MAGIC_HEADER);/*from www. jav a 2 s .c o m*/ dataOutput.writeInt(serializedObject.length); dataOutput.write(compressedBytes); return dataOutput.toByteArray(); } else { return serializedObject; } }