[codec-memcache] encode key directly, no need to use unpooled.

This commit is contained in:
Michael Nitschinger 2013-12-02 13:01:51 +01:00 committed by Trustin Lee
parent a1526bedd3
commit f03c32e137

View File

@ -16,7 +16,6 @@
package io.netty.handler.codec.memcache.binary; package io.netty.handler.codec.memcache.binary;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder; import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.handler.codec.memcache.MemcacheObjectEncoder; import io.netty.handler.codec.memcache.MemcacheObjectEncoder;
@ -64,12 +63,7 @@ public abstract class BinaryMemcacheEncoder<M extends BinaryMemcacheMessage<H>,
return; return;
} }
ByteBuf keyBuf = Unpooled.copiedBuffer(key, CharsetUtil.UTF_8); buf.writeBytes(key.getBytes(CharsetUtil.UTF_8));
try {
buf.writeBytes(keyBuf);
} finally {
keyBuf.release();
}
} }
/** /**