本文整理汇总了Java中cpw.mods.fml.common.network.ByteBufUtils.writeUTF8String方法的典型用法代码示例。如果您正苦于以下问题:Java ByteBufUtils.writeUTF8String方法的具体用法?Java ByteBufUtils.writeUTF8String怎么用?Java ByteBufUtils.writeUTF8String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cpw.mods.fml.common.network.ByteBufUtils
的用法示例。
在下文中一共展示了ByteBufUtils.writeUTF8String方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void write( ByteBuf buffer )
{
buffer.writeInt( data.size() );
Iterator< Entry< UUID, PetData > > it = data.entrySet().iterator();
while ( it.hasNext() )
{
Entry< UUID, PetData > entry = it.next();
UUID id = entry.getKey();
PetData pet = entry.getValue();
buffer.writeLong( id.getMostSignificantBits() );
buffer.writeLong( id.getLeastSignificantBits() );
buffer.writeInt( pet.dim );
buffer.writeInt( pet.pos.x );
buffer.writeInt( pet.pos.y );
buffer.writeInt( pet.pos.z );
ByteBufUtils.writeUTF8String( buffer, pet.name );
ByteBufUtils.writeUTF8String( buffer, pet.tex );
buffer.writeInt( pet.level );
}
}
示例2: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buffer)
{
super.toBytes(buffer);
ByteBufUtils.writeVarInt(buffer, modTags.size(), 2);
for (Map.Entry<String,String> modTag: modTags.entrySet())
{
ByteBufUtils.writeUTF8String(buffer, modTag.getKey());
ByteBufUtils.writeUTF8String(buffer, modTag.getValue());
}
}
示例3: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
void toBytes(ByteBuf buf)
{
buf.writeInt(windowId);
ByteBufUtils.writeUTF8String(buf, modId);
buf.writeInt(modGuiId);
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
}
示例4: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
ByteBufUtils.writeUTF8String(buf, Name);
buf.writeDouble(X);
buf.writeDouble(Y);
buf.writeDouble(Z);
}
示例5: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf)
{
ByteBufUtils.writeVarInt(buf,x,5);
ByteBufUtils.writeVarInt(buf,y,5);
ByteBufUtils.writeVarInt(buf,z,5);
ByteBufUtils.writeVarInt(buf,direction,1);
ByteBufUtils.writeVarInt(buf,isFilling,1);
ByteBufUtils.writeUTF8String(buf,fluidName);
ByteBufUtils.writeVarInt(buf,amount,5);
ByteBufUtils.writeVarInt(buf,size,1);
}
示例6: writeString
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
private void writeString(ByteBuf buf, String string) {
if (string == null) {
buf.writeBoolean(false);
return;
}
buf.writeBoolean(true);
ByteBufUtils.writeUTF8String(buf, string);
}
示例7: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes( ByteBuf pBuffer )
{
pBuffer.writeInt( _mFrame );
pBuffer.writeInt( _mNumFrames );
ByteBufUtils.writeUTF8String( pBuffer, _mPayload );
}
示例8: writeSpawnData
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void writeSpawnData(ByteBuf buffer) {
ByteBufUtils.writeUTF8String(buffer, String.valueOf(Level));
ByteBufUtils.writeUTF8String(buffer, String.valueOf(Faction));
ByteBufUtils.writeUTF8String(buffer, Owner);
}
示例9: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
ByteBufUtils.writeUTF8String(buf, identifier);
buf.writeInt(index);
ByteBufUtils.writeUTF8String(buf, title);
buf.writeLong(created.getTime());
ByteBufUtils.writeUTF8String(buf, author);
buf.writeLong(lastModified.getTime());
ByteBufUtils.writeUTF8String(buf, lastContributor);
ByteBufUtils.writeUTF8String(buf, contents);
}
示例10: writeSpawnData
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void writeSpawnData(ByteBuf buffer) {
ByteBufUtils.writeUTF8String(buffer, UUID);
ByteBufUtils.writeUTF8String(buffer, Name);
ByteBufUtils.writeUTF8String(buffer, String.valueOf(Faction));
ByteBufUtils.writeUTF8String(buffer, Owner);
}
示例11: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
super.toBytes(buf);
buf.writeInt(relX);
buf.writeInt(relY);
buf.writeInt(relZ);
ByteBufUtils.writeUTF8String(buf, name);
}
示例12: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
ByteBufUtils.writeUTF8String(buf, Codename);
buf.writeInt(Faction);
buf.writeInt(Level);
buf.writeInt(AP);
buf.writeInt(XM);
}
示例13: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
buf.writeInt(val);
ByteBufUtils.writeUTF8String(buf, componentName);
}
示例14: toBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void toBytes(ByteBuf buffer)
{
ByteBufUtils.writeVarInt(buffer, modIds.size(), 3);
for (Entry<String, Integer> entry: modIds.entrySet())
{
ByteBufUtils.writeUTF8String(buffer, entry.getKey());
ByteBufUtils.writeVarInt(buffer, entry.getValue(), 3);
}
}
示例15: testByteBufUtilsStrings
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Test
public void testByteBufUtilsStrings()
{
String test = new String("test");
ByteBuf buf = Unpooled.buffer(20, 20);
ByteBufUtils.writeUTF8String(buf, test);
assertArrayEquals("String bytes", new byte[] { 4, 116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, buf.array());
String repeat = Strings.repeat("test", 100);
buf = Unpooled.buffer(420, 420);
ByteBufUtils.writeUTF8String(buf, repeat);
assertArrayEquals("String repeat bytes", new byte[] {-112, 3, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, buf.array());
}