From 22be797054a27a749af48a517472c6100b1e7d15 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Tue, 16 Jul 2013 07:24:45 +0200 Subject: [PATCH] Use Unpooled to allocate buffer in Base64 --- codec/src/main/java/io/netty/handler/codec/base64/Base64.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codec/src/main/java/io/netty/handler/codec/base64/Base64.java b/codec/src/main/java/io/netty/handler/codec/base64/Base64.java index a1a9aa6635..f01072f159 100644 --- a/codec/src/main/java/io/netty/handler/codec/base64/Base64.java +++ b/codec/src/main/java/io/netty/handler/codec/base64/Base64.java @@ -20,6 +20,7 @@ package io.netty.handler.codec.base64; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; /** * Utility class for {@link ByteBuf} that encodes and decodes to and from @@ -112,7 +113,7 @@ public final class Base64 { } int len43 = len * 4 / 3; - ByteBuf dest = src.alloc().buffer( + ByteBuf dest = Unpooled.buffer( len43 + (len % 3 > 0 ? 4 : 0) + // Account for padding (breakLines ? len43 / MAX_LINE_LENGTH : 0)).order(src.order()); // New lines