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


Java ByteBufInputStream.close方法代碼示例

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


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

示例1: onServerPacket

import io.netty.buffer.ByteBufInputStream; //導入方法依賴的package包/類
@SubscribeEvent
public void onServerPacket(ServerCustomPacketEvent event) throws IOException
{
    ByteBufInputStream bbis = new ByteBufInputStream(event.packet.payload());
    EntityPlayer entityPlayer = ((NetHandlerPlayServer) event.handler).playerEntity;
    int packetId = bbis.readInt();
    if (packetId < packetCarrier.size()) {
        try {
            ICarpentersPacket packetClass = (ICarpentersPacket) packetCarrier.get(packetId).newInstance();
            packetClass.processData(entityPlayer, bbis);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else {
        ModLogger.log(Level.WARN, "Encountered out of range packet Id: " + packetId);
    }
    bbis.close();
}
 
開發者ID:Mineshopper,項目名稱:carpentersblocks,代碼行數:19,代碼來源:PacketHandler.java

示例2: decode

import io.netty.buffer.ByteBufInputStream; //導入方法依賴的package包/類
@Override
protected void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List<Object> out) throws Exception {
	ByteBuf packetPayload = msg.payload();
	byte indexOfClass = packetPayload.readByte();
	ByteBufInputStream bbis = new ByteBufInputStream(packetPayload.slice());
	Class<? extends CLLPacket> packetClass = registeredPackets.get(indexOfClass);
	if(packetClass != null){
		CLLPacket packetCLL = packetClass.newInstance();
		packetCLL.readDataFrom(bbis);
		switch(FMLCommonHandler.instance().getEffectiveSide()){
		case CLIENT:
			handleClient(packetCLL);
			break;
		case SERVER:
			packetCLL.handleServerSide(((NetHandlerPlayServer)ctx.channel().attr(NetworkRegistry.NET_HANDLER).get()).player);
			break;			
		}
		bbis.close();
		out.add(packetCLL);
	}
}
 
開發者ID:Phlenum,項目名稱:Combustible-Lemon-Launcher,代碼行數:22,代碼來源:CLLPacketHandler.java

示例3: channelRead0

import io.netty.buffer.ByteBufInputStream; //導入方法依賴的package包/類
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket dp) throws Exception {
  ByteBufInputStream bis = new ByteBufInputStream(dp.content());
  try {
    ClusterStatusProtos.ClusterStatus csp = ClusterStatusProtos.ClusterStatus.parseFrom(bis);
    ClusterStatus ncs = ClusterStatus.convert(csp);
    receive(ncs);
  } finally {
    bis.close();
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:12,代碼來源:ClusterStatusListener.java

示例4: onPacketData

import io.netty.buffer.ByteBufInputStream; //導入方法依賴的package包/類
@SubscribeEvent
public void onPacketData(ClientCustomPacketEvent event) {
    FMLProxyPacket packet = event.packet;
    packet.payload().array();
    try {
        ByteBufInputStream input = new ByteBufInputStream(event.packet.payload());
        MiscellaneousNonsense.proxy.handleTpsReport(input.readFloat());
        input.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return;
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:14,代碼來源:MiscNet.java

示例5: closeByteBuffer

import io.netty.buffer.ByteBufInputStream; //導入方法依賴的package包/類
public static void closeByteBuffer(ByteBufInputStream is) {
    if (is == null) return;
    try {
        is.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:9,代碼來源:FzNetEventHandler.java

示例6: fromBytes

import io.netty.buffer.ByteBufInputStream; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf) {

    try {
        ByteBufInputStream bbis = new ByteBufInputStream(buf);
        read(bbis);
        bbis.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
開發者ID:Qmunity,項目名稱:QmunityLib,代碼行數:12,代碼來源:Packet.java


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