本文整理了Java中io.gomint.server.jni.zlib.ZLib.process()
方法的一些代码示例,展示了ZLib.process()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZLib.process()
方法的具体详情如下:
包路径:io.gomint.server.jni.zlib.ZLib
类名称: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 );
内容来源于网络,如有侵权,请联系作者删除!