當前位置: 首頁>>代碼示例>>Java>>正文


Java ByteBufOutputStream.writeInt方法代碼示例

本文整理匯總了Java中io.netty.buffer.ByteBufOutputStream.writeInt方法的典型用法代碼示例。如果您正苦於以下問題:Java ByteBufOutputStream.writeInt方法的具體用法?Java ByteBufOutputStream.writeInt怎麽用?Java ByteBufOutputStream.writeInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.netty.buffer.ByteBufOutputStream的用法示例。


在下文中一共展示了ByteBufOutputStream.writeInt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toBytes

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
public void toBytes(ByteBuf buf)
{
    ByteBufOutputStream output = new ByteBufOutputStream(buf);

    try
    {
        output.writeUTF(this.filename);
        output.writeInt(this.frames.size());

        for (Frame frame : this.frames)
        {
            frame.toBytes(output);
        }
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}
 
開發者ID:mchorse,項目名稱:blockbuster,代碼行數:21,代碼來源:PacketFrames.java

示例2: write

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
public void write(ByteBufOutputStream byteBuf) throws IOException {
	byteBuf.writeBoolean(this.ok);
	byteBuf.writeInt(this.minPort);
	byteBuf.writeInt(this.maxPort);
	byteBuf.writeUTF(this.resources);
}
 
開發者ID:MinecraftCloudSystem,項目名稱:MCS-Master,代碼行數:8,代碼來源:PacketAuthResponse.java

示例3: toBytes

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
public void toBytes(ByteBuf buf)
{
    ByteBufOutputStream stream = new ByteBufOutputStream(buf);

    try
    {
        stream.writeInt(this.skins.size());

        /* Write skins */
        for (Map.Entry<String, Map<String, ByteBuf>> entry : this.skins.entrySet())
        {
            stream.writeUTF(entry.getKey());
            stream.writeInt(entry.getValue().size());

            for (Map.Entry<String, ByteBuf> skin : entry.getValue().entrySet())
            {
                ByteBuf buffer = skin.getValue();

                stream.writeUTF(skin.getKey());
                buf.writeInt(buffer.readableBytes());
                buf.writeBytes(buffer);
            }
        }

        stream.writeInt(this.models.size());

        /* Write models */
        for (Map.Entry<String, String> model : this.models.entrySet())
        {
            stream.writeUTF(model.getKey());
            stream.writeUTF(model.getValue());
        }
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}
 
開發者ID:mchorse,項目名稱:blockbuster,代碼行數:40,代碼來源:PacketModels.java

示例4: writeMessage

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@SneakyThrows(IOException.class)
private void writeMessage(AppendBlock block, ByteBuf out) {
    int startIdx = out.writerIndex();
    ByteBufOutputStream bout = new ByteBufOutputStream(out);
    bout.writeInt(block.getType().getCode());
    bout.write(LENGTH_PLACEHOLDER);
    block.writeFields(bout);
    bout.flush();
    bout.close();
    int endIdx = out.writerIndex();
    int fieldsSize = endIdx - startIdx - TYPE_PLUS_LENGTH_SIZE;
    out.setInt(startIdx + TYPE_SIZE, fieldsSize + currentBlockSize);
}
 
開發者ID:pravega,項目名稱:pravega,代碼行數:14,代碼來源:CommandEncoder.java

示例5: writeData

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
protected void writeData(ByteBufOutputStream buffer) throws IOException {
    buffer.writeInt(tileLocationX);
    buffer.writeInt(tileLocationY);
    buffer.writeInt(tileLocationZ);
    buffer.writeInt(text.length);
    for (String string : text) {
        buffer.writeInt(string.length());
        buffer.writeChars(string);
    }
}
 
開發者ID:soultek101,項目名稱:projectzulu1.7.10-pre-1.3a,代碼行數:12,代碼來源:PacketTileText.java

示例6: writeData

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
protected void writeData(ByteBufOutputStream buffer) throws IOException {
    buffer.writeInt(posX);
    buffer.writeInt(posY);
    buffer.writeInt(posZ);
    buffer.writeInt(sound.length());
    buffer.writeChars(sound);
}
 
開發者ID:soultek101,項目名稱:projectzulu1.7.10-pre-1.3a,代碼行數:9,代碼來源:PacketStreamSound.java

示例7: encodeInto

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) throws IOException {
	ByteBufOutputStream bos = new ByteBufOutputStream(buffer);
	bos.writeInt(x);
	bos.writeInt(y);
	bos.writeInt(z);
	NBTHelper.nbtWrite(tag, bos);
}
 
開發者ID:DavidGoldman,項目名稱:NBTEdit,代碼行數:9,代碼來源:TileNBTPacket.java

示例8: write

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
public void write(ByteBufOutputStream out) throws IOException {
    out.writeInt(x);
    out.writeInt(y);
    out.writeInt(z);
    if (payload != null) {
        payload.write(out);
    }
}
 
開發者ID:sk89q,項目名稱:playblock,代碼行數:10,代碼來源:TileEntityPayload.java

示例9: writeData

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
protected void writeData(ByteBufOutputStream buffer) throws IOException {
    buffer.writeInt(tileLocationX);
    buffer.writeInt(tileLocationY);
    buffer.writeInt(tileLocationZ);
    buffer.writeInt(text.length);
    for (String string : text) {
        buffer.writeInt(string.length());
        buffer.writeChars(string);
    }
}
 
開發者ID:soultek101,項目名稱:projectzulu1.7.10,代碼行數:11,代碼來源:PZPacketTileText.java

示例10: writeData

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
protected void writeData(ByteBufOutputStream buffer) throws IOException {
    buffer.writeInt(posX);
    buffer.writeInt(posY);
    buffer.writeInt(posZ);
    buffer.writeInt(sound.length());
    buffer.writeChars(sound);
}
 
開發者ID:soultek101,項目名稱:projectzulu1.7.10,代碼行數:8,代碼來源:PZPacketPlaySound.java

示例11: encodeInto

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
public void encodeInto(ChannelHandlerContext ctx, ByteBuf to) throws IOException {
	ByteBufOutputStream bos = new ByteBufOutputStream(to);
	bos.writeUTF(script);
	bos.writeInt(settings.length);
	for (Setting s : settings)
		Setting.write(s, bos);
}
 
開發者ID:DavidGoldman,項目名稱:MinecraftScripting,代碼行數:9,代碼來源:SettingsPacket.java

示例12: encodeInto

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
public void encodeInto(ChannelHandlerContext ctx, ByteBuf to) throws IOException { 
	ByteBufOutputStream bos = new ByteBufOutputStream(to);
	bos.writeInt(x);
	bos.writeInt(y);
	bos.writeInt(z);
	writeNBT(tag, bos);
}
 
開發者ID:DavidGoldman,項目名稱:MinecraftScripting,代碼行數:9,代碼來源:TileNBTPacket.java

示例13: write

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
public void write(ByteBufOutputStream byteBuf) throws IOException {
	byteBuf.writeInt(this.cpuUsage);
	byteBuf.writeInt(this.ramUsage);
	byteBuf.writeInt(this.ramMax);
}
 
開發者ID:MinecraftCloudSystem,項目名稱:MCS-Master,代碼行數:7,代碼來源:PacketServerStatus.java

示例14: write

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
public void write(ByteBufOutputStream byteBuf) throws IOException {
	byteBuf.writeUTF(this.serverType);
	byteBuf.writeInt(this.port);
}
 
開發者ID:MinecraftCloudSystem,項目名稱:MCS-Master,代碼行數:6,代碼來源:PacketServerStarted.java

示例15: writeData

import io.netty.buffer.ByteBufOutputStream; //導入方法依賴的package包/類
@Override
protected void writeData(ByteBufOutputStream buffer) throws IOException {
    buffer.writeInt(entityIdToBeNamed);
    buffer.writeInt(entityName.length());
    buffer.writeChars(entityName);
}
 
開發者ID:soultek101,項目名稱:projectzulu1.7.10-pre-1.3a,代碼行數:7,代碼來源:PacketNameSync.java


注:本文中的io.netty.buffer.ByteBufOutputStream.writeInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。