gpt4 book ai didi

io.gomint.server.jni.zlib.ZLib.process()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 16:44:31 33 4
gpt4 key购买 nike

本文整理了Java中io.gomint.server.jni.zlib.ZLib.process()方法的一些代码示例,展示了ZLib.process()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZLib.process()方法的具体详情如下:
包路径:io.gomint.server.jni.zlib.ZLib
类名称:ZLib
方法名:process

ZLib.process介绍

暂无

代码示例

代码示例来源:origin: GoMint/GoMint

@Override
protected void encode( ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out ) throws Exception {
  int origSize = msg.readableBytes();
  if ( origSize < 256 ) {
    out.writeInt( 0 );
    out.writeBytes( msg );
  } else {
    out.writeInt( origSize );
    zlib.process( msg, out );
  }
}

代码示例来源:origin: GoMint/ProxProx

@Override
protected void encode( ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out ) throws Exception {
  int origSize = msg.readableBytes();
  if ( origSize < 256 ) {
    out.writeInt( 0 );
    out.writeBytes( msg );
  } else {
    out.writeInt( origSize );
    zlib.process( msg, out );
  }
}

代码示例来源:origin: GoMint/ProxProx

private byte[] zlibCompress( ByteBuf inBuf ) {
  ZLib compressor = this.getCompressor();
  ByteBuf outBuf = newNettyBuffer();
  try {
    compressor.process( inBuf, outBuf );
  } catch ( DataFormatException e ) {
    LOGGER.error( "Could not compress data for network", e );
    outBuf.release();
    return null;
  }
  byte[] data = new byte[outBuf.readableBytes()];
  outBuf.readBytes( data );
  outBuf.release();
  return data;
}

代码示例来源:origin: GoMint/GoMint

private byte[] zlibCompress(ByteBuf inBuf) {
  ZLib compressor = this.getCompressor();
  ByteBuf outBuf = newNettyBuffer();
  try {
    compressor.process(inBuf, outBuf);
  } catch (DataFormatException e) {
    LOGGER.error("Could not compress data for network", e);
    outBuf.release();
    return null;
  }
  byte[] data = new byte[outBuf.readableBytes()];
  outBuf.readBytes(data);
  outBuf.release();
  return data;
}

代码示例来源:origin: GoMint/GoMint

@Override
protected void decode( ChannelHandlerContext ctx, ByteBuf in, List<Object> out ) throws Exception {
  int size = in.readInt();
  if ( size == 0 ) {
    out.add( in.slice().retain() );
    in.skipBytes( in.readableBytes() );
  } else {
    ByteBuf decompressed = ctx.alloc().directBuffer();
    try {
      zlib.process( in, decompressed );
      Preconditions.checkState( decompressed.readableBytes() == size, "Decompressed packet size mismatch" );
      out.add( decompressed );
      decompressed = null;
    } finally {
      if ( decompressed != null ) {
        decompressed.release();
      }
    }
  }
}

代码示例来源:origin: GoMint/ProxProx

@Override
protected void decode( ChannelHandlerContext ctx, ByteBuf in, List<Object> out ) throws Exception {
  int size = in.readInt();
  if ( size == 0 ) {
    out.add( in.slice().retain() );
    in.skipBytes( in.readableBytes() );
  } else {
    ByteBuf decompressed = ctx.alloc().directBuffer();
    try {
      zlib.process( in, decompressed );
      Preconditions.checkState( decompressed.readableBytes() == size, "Decompressed packet size mismatch" );
      out.add( decompressed );
      decompressed = null;
    } finally {
      if ( decompressed != null ) {
        decompressed.release();
      }
    }
  }
}

代码示例来源:origin: GoMint/GoMint

DECOMPRESSOR.process( inBuf, outBuf );
} catch ( Exception e ) {
  e.printStackTrace();

代码示例来源:origin: GoMint/GoMint

this.decompressor.process(inBuf, outBuf);
} catch (DataFormatException e) {
  LOGGER.error("Failed to decompress batch packet", e);

代码示例来源:origin: GoMint/ProxProx

this.decompressor.process( inBuf, outBuf );
} catch ( DataFormatException e ) {
  LOGGER.error( "Failed to decompress batch packet", e );

代码示例来源:origin: GoMint/GoMint

compressor.process( inBuf, outBuf );
} catch ( Exception e ) {
  LOGGER.error( "Could not compress data for network", e );

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com