本文整理匯總了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();
}
示例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);
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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();
}
}