Make UnpooledDirectByteBuf, UnpooledHeapByteBuf and UnpooledUnsafeDirectByteBuf constructors public.
Motivation: The constrcutors a protected atm but the classes are public. We should make the constructors public as well to make it easier to write your own ByteBufAllocator. Modifications: Change constructors to be public and add some javadocs. Result: Easier to create own ByteBufAllocator.
This commit is contained in:
parent
3c8c7fc7e9
commit
9d56439aa1
@ -28,9 +28,9 @@ import java.nio.channels.GatheringByteChannel;
|
||||
import java.nio.channels.ScatteringByteChannel;
|
||||
|
||||
/**
|
||||
* A NIO {@link ByteBuffer} based buffer. It is recommended to use {@link Unpooled#directBuffer(int)}
|
||||
* and {@link Unpooled#wrappedBuffer(ByteBuffer)} instead of calling the
|
||||
* constructor explicitly.
|
||||
* A NIO {@link ByteBuffer} based buffer. It is recommended to use
|
||||
* {@link UnpooledByteBufAllocator#directBuffer(int, int)}, {@link Unpooled#directBuffer(int)} and
|
||||
* {@link Unpooled#wrappedBuffer(ByteBuffer)} instead of calling the constructor explicitly.
|
||||
*/
|
||||
public class UnpooledDirectByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
|
||||
@ -47,7 +47,7 @@ public class UnpooledDirectByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
* @param initialCapacity the initial capacity of the underlying direct buffer
|
||||
* @param maxCapacity the maximum capacity of the underlying direct buffer
|
||||
*/
|
||||
protected UnpooledDirectByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
public UnpooledDirectByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
super(maxCapacity);
|
||||
if (alloc == null) {
|
||||
throw new NullPointerException("alloc");
|
||||
|
@ -30,7 +30,9 @@ import java.nio.channels.ScatteringByteChannel;
|
||||
import static io.netty.util.internal.ObjectUtil.checkNotNull;
|
||||
|
||||
/**
|
||||
* Big endian Java heap buffer implementation.
|
||||
* Big endian Java heap buffer implementation. It is recommended to use
|
||||
* {@link UnpooledByteBufAllocator#heapBuffer(int, int)}, {@link Unpooled#buffer(int)} and
|
||||
* {@link Unpooled#wrappedBuffer(byte[])} instead of calling the constructor explicitly.
|
||||
*/
|
||||
public class UnpooledHeapByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
|
||||
@ -44,7 +46,7 @@ public class UnpooledHeapByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
* @param initialCapacity the initial capacity of the underlying byte array
|
||||
* @param maxCapacity the max capacity of the underlying byte array
|
||||
*/
|
||||
protected UnpooledHeapByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
public UnpooledHeapByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
super(maxCapacity);
|
||||
|
||||
checkNotNull(alloc, "alloc");
|
||||
|
@ -28,9 +28,9 @@ import java.nio.channels.GatheringByteChannel;
|
||||
import java.nio.channels.ScatteringByteChannel;
|
||||
|
||||
/**
|
||||
* A NIO {@link ByteBuffer} based buffer. It is recommended to use {@link Unpooled#directBuffer(int)}
|
||||
* and {@link Unpooled#wrappedBuffer(ByteBuffer)} instead of calling the
|
||||
* constructor explicitly.
|
||||
* A NIO {@link ByteBuffer} based buffer. It is recommended to use
|
||||
* {@link UnpooledByteBufAllocator#directBuffer(int, int)}, {@link Unpooled#directBuffer(int)} and
|
||||
* {@link Unpooled#wrappedBuffer(ByteBuffer)} instead of calling the constructor explicitly.}
|
||||
*/
|
||||
public class UnpooledUnsafeDirectByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
|
||||
@ -48,7 +48,7 @@ public class UnpooledUnsafeDirectByteBuf extends AbstractReferenceCountedByteBuf
|
||||
* @param initialCapacity the initial capacity of the underlying direct buffer
|
||||
* @param maxCapacity the maximum capacity of the underlying direct buffer
|
||||
*/
|
||||
protected UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
public UnpooledUnsafeDirectByteBuf(ByteBufAllocator alloc, int initialCapacity, int maxCapacity) {
|
||||
super(maxCapacity);
|
||||
if (alloc == null) {
|
||||
throw new NullPointerException("alloc");
|
||||
|
Loading…
x
Reference in New Issue
Block a user