Make Unpooled*ByteBuf public so that ByteBufAllocator implementor can extend it
This commit is contained in:
parent
05bc0ba17f
commit
0ac31ae846
@ -34,7 +34,7 @@ import java.util.Queue;
|
||||
* and {@link Unpooled#wrappedBuffer(ByteBuffer)} instead of calling the
|
||||
* constructor explicitly.
|
||||
*/
|
||||
final class UnpooledDirectByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
public class UnpooledDirectByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
|
||||
private final ResourceLeak leak = leakDetector.open(this);
|
||||
private final ByteBufAllocator alloc;
|
||||
@ -51,7 +51,7 @@ final class UnpooledDirectByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
* @param initialCapacity the initial capacity of the underlying direct buffer
|
||||
* @param maxCapacity the maximum capacity of the underlying direct buffer
|
||||
*/
|
||||
UnpooledDirectByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
protected UnpooledDirectByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
super(maxCapacity);
|
||||
if (alloc == null) {
|
||||
throw new NullPointerException("alloc");
|
||||
@ -76,7 +76,7 @@ final class UnpooledDirectByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
*
|
||||
* @param maxCapacity the maximum capacity of the underlying direct buffer
|
||||
*/
|
||||
UnpooledDirectByteBuf(ByteBufAllocator alloc, ByteBuffer initialBuffer, int maxCapacity) {
|
||||
protected UnpooledDirectByteBuf(ByteBufAllocator alloc, ByteBuffer initialBuffer, int maxCapacity) {
|
||||
super(maxCapacity);
|
||||
if (alloc == null) {
|
||||
throw new NullPointerException("alloc");
|
||||
|
@ -29,7 +29,7 @@ import java.nio.channels.ScatteringByteChannel;
|
||||
/**
|
||||
* Big endian Java heap buffer implementation.
|
||||
*/
|
||||
final class UnpooledHeapByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
public class UnpooledHeapByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
|
||||
private final ByteBufAllocator alloc;
|
||||
private byte[] array;
|
||||
@ -41,7 +41,7 @@ final class UnpooledHeapByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
* @param initialCapacity the initial capacity of the underlying byte array
|
||||
* @param maxCapacity the max capacity of the underlying byte array
|
||||
*/
|
||||
public UnpooledHeapByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
protected UnpooledHeapByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
this(alloc, new byte[initialCapacity], 0, 0, maxCapacity);
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ final class UnpooledHeapByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
* @param initialArray the initial underlying byte array
|
||||
* @param maxCapacity the max capacity of the underlying byte array
|
||||
*/
|
||||
public UnpooledHeapByteBuf(ByteBufAllocator alloc, byte[] initialArray, int maxCapacity) {
|
||||
protected UnpooledHeapByteBuf(ByteBufAllocator alloc, byte[] initialArray, int maxCapacity) {
|
||||
this(alloc, initialArray, 0, initialArray.length, maxCapacity);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import java.util.Queue;
|
||||
* and {@link Unpooled#wrappedBuffer(ByteBuffer)} instead of calling the
|
||||
* constructor explicitly.
|
||||
*/
|
||||
final class UnpooledUnsafeDirectByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
public class UnpooledUnsafeDirectByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
|
||||
private static final boolean NATIVE_ORDER = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
|
||||
|
||||
@ -54,7 +54,7 @@ final class UnpooledUnsafeDirectByteBuf extends AbstractReferenceCountedByteBuf
|
||||
* @param initialCapacity the initial capacity of the underlying direct buffer
|
||||
* @param maxCapacity the maximum capacity of the underlying direct buffer
|
||||
*/
|
||||
UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
protected UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
super(maxCapacity);
|
||||
if (alloc == null) {
|
||||
throw new NullPointerException("alloc");
|
||||
@ -79,7 +79,7 @@ final class UnpooledUnsafeDirectByteBuf extends AbstractReferenceCountedByteBuf
|
||||
*
|
||||
* @param maxCapacity the maximum capacity of the underlying direct buffer
|
||||
*/
|
||||
UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, ByteBuffer initialBuffer, int maxCapacity) {
|
||||
protected UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, ByteBuffer initialBuffer, int maxCapacity) {
|
||||
super(maxCapacity);
|
||||
if (alloc == null) {
|
||||
throw new NullPointerException("alloc");
|
||||
|
Loading…
x
Reference in New Issue
Block a user