Use the allocator of the src ByteBuf to allocate the new ByteBuf
This commit is contained in:
parent
9b9f621690
commit
7522d530ac
@ -20,7 +20,6 @@
|
||||
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
|
||||
@ -113,7 +112,7 @@ public final class Base64 {
|
||||
}
|
||||
|
||||
int len43 = len * 4 / 3;
|
||||
ByteBuf dest = Unpooled.buffer(
|
||||
ByteBuf dest = src.alloc().buffer(
|
||||
len43 +
|
||||
(len % 3 > 0 ? 4 : 0) + // Account for padding
|
||||
(breakLines ? len43 / MAX_LINE_LENGTH : 0)).order(src.order()); // New lines
|
||||
@ -217,7 +216,7 @@ public final class Base64 {
|
||||
byte[] DECODABET = decodabet(dialect);
|
||||
|
||||
int len34 = len * 3 / 4;
|
||||
ByteBuf dest = Unpooled.buffer(len34).order(src.order()); // Upper limit on size of output
|
||||
ByteBuf dest = src.alloc().buffer(len34).order(src.order()); // Upper limit on size of output
|
||||
int outBuffPosn = 0;
|
||||
|
||||
byte[] b4 = new byte[4];
|
||||
|
Loading…
Reference in New Issue
Block a user