Add javadocs
This commit is contained in:
parent
e5c326949d
commit
1c6ed9b2ce
@ -16,15 +16,26 @@
|
||||
|
||||
package io.netty.buffer;
|
||||
|
||||
/**
|
||||
* Skeltal {@link ByteBufAllocator} implementation to extend.
|
||||
*/
|
||||
public abstract class AbstractByteBufAllocator implements ByteBufAllocator {
|
||||
|
||||
private final boolean directByDefault;
|
||||
private final ByteBuf emptyBuf;
|
||||
|
||||
/**
|
||||
* Instance use heap buffers by default
|
||||
*/
|
||||
protected AbstractByteBufAllocator() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new instance
|
||||
*
|
||||
* @param directByDefault {@code true} if direct buffers should be used by default.
|
||||
*/
|
||||
protected AbstractByteBufAllocator(boolean directByDefault) {
|
||||
this.directByDefault = directByDefault;
|
||||
emptyBuf = new UnpooledHeapByteBuf(this, 0, 0);
|
||||
@ -139,6 +150,13 @@ public abstract class AbstractByteBufAllocator implements ByteBufAllocator {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a heap {@link ByteBuf} with the given initialCapacity and maxCapacity.
|
||||
*/
|
||||
protected abstract ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity);
|
||||
|
||||
/**
|
||||
* Create a direct {@link ByteBuf} with the given initialCapacity and maxCapacity.
|
||||
*/
|
||||
protected abstract ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity);
|
||||
}
|
||||
|
@ -16,6 +16,10 @@
|
||||
|
||||
package io.netty.buffer;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link ByteBuf} implementations that wrap another
|
||||
* {@link ByteBuf}.
|
||||
*/
|
||||
public abstract class AbstractDerivedByteBuf extends AbstractByteBuf {
|
||||
|
||||
protected AbstractDerivedByteBuf(int maxCapacity) {
|
||||
|
@ -19,6 +19,10 @@ package io.netty.buffer;
|
||||
import java.util.AbstractQueue;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link MessageBuf} implementations.
|
||||
* @param <T>
|
||||
*/
|
||||
public abstract class AbstractMessageBuf<T> extends AbstractQueue<T> implements MessageBuf<T> {
|
||||
|
||||
private final int maxCapacity;
|
||||
|
@ -18,6 +18,9 @@ package io.netty.buffer;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link ByteBuf} implementations that count references.
|
||||
*/
|
||||
public abstract class AbstractReferenceCountedByteBuf extends AbstractByteBuf {
|
||||
|
||||
private static final AtomicIntegerFieldUpdater<AbstractReferenceCountedByteBuf> refCntUpdater =
|
||||
|
@ -15,23 +15,97 @@
|
||||
*/
|
||||
package io.netty.buffer;
|
||||
|
||||
/**
|
||||
* Implementations are responsible to allocate buffers. Implementations of this interface are expected to be
|
||||
* thread-safe.
|
||||
*/
|
||||
public interface ByteBufAllocator {
|
||||
|
||||
/**
|
||||
* Allocate a {@link ByteBuf}. If it is a direct or heap buffer
|
||||
* depends on the actual implementation.
|
||||
*/
|
||||
ByteBuf buffer();
|
||||
|
||||
/**
|
||||
* Allocate a {@link ByteBuf} with the given initial capacity.
|
||||
* If it is a direct or heap buffer depends on the actual implementation.
|
||||
*/
|
||||
ByteBuf buffer(int initialCapacity);
|
||||
|
||||
/**
|
||||
* Allocate a {@link ByteBuf} with the given initial capacity and the given
|
||||
* maximal capacity. If it is a direct or heap buffer depends on the actual
|
||||
* implementation.
|
||||
*/
|
||||
ByteBuf buffer(int initialCapacity, int maxCapacity);
|
||||
|
||||
/**
|
||||
* Allocate a heap {@link ByteBuf}.
|
||||
*/
|
||||
ByteBuf heapBuffer();
|
||||
|
||||
/**
|
||||
* Allocate a heap {@link ByteBuf} with the given initial capacity.
|
||||
*/
|
||||
ByteBuf heapBuffer(int initialCapacity);
|
||||
|
||||
/**
|
||||
* Allocate a heap {@link ByteBuf} with the given initial capacity and the given
|
||||
* maximal capacity.
|
||||
*/
|
||||
ByteBuf heapBuffer(int initialCapacity, int maxCapacity);
|
||||
|
||||
/**
|
||||
* Allocate a direct {@link ByteBuf}.
|
||||
*/
|
||||
ByteBuf directBuffer();
|
||||
|
||||
/**
|
||||
* Allocate a direct {@link ByteBuf} with the given initial capacity.
|
||||
*/
|
||||
ByteBuf directBuffer(int initialCapacity);
|
||||
|
||||
/**
|
||||
* Allocate a direct {@link ByteBuf} with the given initial capacity and the given
|
||||
* maximal capacity.
|
||||
*/
|
||||
ByteBuf directBuffer(int initialCapacity, int maxCapacity);
|
||||
|
||||
/**
|
||||
* Allocate a {@link ByteBuf} which is used for reading data in from the actual transport.
|
||||
*/
|
||||
ByteBuf ioBuffer();
|
||||
|
||||
/**
|
||||
* Allocate a {@link CompositeByteBuf}.
|
||||
* If it is a direct or heap buffer depends on the actual implementation.
|
||||
*/
|
||||
CompositeByteBuf compositeBuffer();
|
||||
|
||||
/**
|
||||
* Allocate a {@link CompositeByteBuf} with the given maximum number of components that can be stored in it.
|
||||
* If it is a direct or heap buffer depends on the actual implementation.
|
||||
*/
|
||||
CompositeByteBuf compositeBuffer(int maxNumComponents);
|
||||
|
||||
/**
|
||||
* Allocate a heap {@link CompositeByteBuf}.
|
||||
*/
|
||||
CompositeByteBuf compositeHeapBuffer();
|
||||
|
||||
/**
|
||||
* Allocate a heap {@link CompositeByteBuf} with the given maximum number of components that can be stored in it.
|
||||
*/
|
||||
CompositeByteBuf compositeHeapBuffer(int maxNumComponents);
|
||||
|
||||
/**
|
||||
* Allocate a direct {@link CompositeByteBuf}.
|
||||
*/
|
||||
CompositeByteBuf compositeDirectBuffer();
|
||||
|
||||
/**
|
||||
* Allocate a direct {@link CompositeByteBuf} with the given maximum number of components that can be stored in it.
|
||||
*/
|
||||
CompositeByteBuf compositeDirectBuffer(int maxNumComponents);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user