T
- public abstract class AbstractMessageBuf<T> extends AbstractQueue<T> implements MessageBuf<T>
MessageBuf
implementations.Modifier | Constructor and Description |
---|---|
protected |
AbstractMessageBuf(int maxCapacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T t) |
protected abstract void |
deallocate() |
int |
drainTo(Collection<? super T> c)
Drain the content of te
MessageBuf to the given Collection . |
int |
drainTo(Collection<? super T> c,
int maxElements)
Drain the content of te
MessageBuf to the given Collection . |
T |
element() |
protected void |
ensureAccessible() |
boolean |
isReadable()
Returns
true if and only if this buffer contains at least one readable element. |
boolean |
isReadable(int size)
Returns
true if and only if this buffer contains equal to or more than the specified number of elements. |
boolean |
isWritable()
Returns
true if and only if this buffer has enough room to allow writing one element. |
boolean |
isWritable(int size)
Returns
true if and only if this buffer has enough room to allow writing the specified number of
elements. |
int |
maxCapacity()
Returns the maximum allowed capacity of this buffer.
|
int |
refCnt()
Returns the reference count of this object.
|
boolean |
release()
Decreases the reference count by
1 and deallocates this object if the reference count reaches at
0 . |
boolean |
release(int decrement)
Decreases the reference count by the specified
decrement and deallocates this object if the reference
count reaches at 0 . |
T |
remove() |
MessageBuf<T> |
retain()
Increases the reference count by
1 . |
MessageBuf<T> |
retain(int increment)
Increases the reference count by the specified
increment . |
String |
toString() |
BufType |
type()
The BufType which will be handled by the Buf implementation
|
boolean |
unfoldAndAdd(Object o)
Unfold the specified object if necessary, and then add the unfolded objects (or the specified object if
unfonding was not necessary) to this buffer.
|
addAll, clear
contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
public final BufType type()
Buf
public final int refCnt()
ReferenceCounted
0
, it means this object has been deallocated.refCnt
in interface ReferenceCounted
public MessageBuf<T> retain()
ReferenceCounted
1
.retain
in interface Buf
retain
in interface MessageBuf<T>
retain
in interface ReferenceCounted
public MessageBuf<T> retain(int increment)
ReferenceCounted
increment
.retain
in interface Buf
retain
in interface MessageBuf<T>
retain
in interface ReferenceCounted
public final boolean release()
ReferenceCounted
1
and deallocates this object if the reference count reaches at
0
.release
in interface ReferenceCounted
true
if and only if the reference count became 0
and this object has been deallocatedpublic final boolean release(int decrement)
ReferenceCounted
decrement
and deallocates this object if the reference
count reaches at 0
.release
in interface ReferenceCounted
true
if and only if the reference count became 0
and this object has been deallocatedprotected abstract void deallocate()
public final int maxCapacity()
Buf
maxCapacity
in interface Buf
public final boolean isReadable()
Buf
true
if and only if this buffer contains at least one readable element.isReadable
in interface Buf
public final boolean isReadable(int size)
Buf
true
if and only if this buffer contains equal to or more than the specified number of elements.isReadable
in interface Buf
public final boolean isWritable()
Buf
true
if and only if this buffer has enough room to allow writing one element.isWritable
in interface Buf
public final boolean isWritable(int size)
Buf
true
if and only if this buffer has enough room to allow writing the specified number of
elements.isWritable
in interface Buf
protected final void ensureAccessible()
public final boolean add(T t)
add
in interface Collection<T>
add
in interface Queue<T>
add
in class AbstractQueue<T>
public final T remove()
public final T element()
public boolean unfoldAndAdd(Object o)
MessageBuf
Object[]
),
this method adds the elements of the array to this buffer until null
is encountered. If the specified
object is null
, nothing is added to this buffer. Otherwise, the specified object is added to this
buffer as-is.unfoldAndAdd
in interface MessageBuf<T>
true
if one or more messages were added to this buffer. false
otherwise.public int drainTo(Collection<? super T> c)
MessageBuf
MessageBuf
to the given Collection
.drainTo
in interface MessageBuf<T>
c
- the Collection
to drain the content topublic int drainTo(Collection<? super T> c, int maxElements)
MessageBuf
MessageBuf
to the given Collection
.drainTo
in interface MessageBuf<T>
c
- the Collection
to drain the content tomaxElements
- the max number of elements to drainpublic String toString()
toString
in class AbstractCollection<T>
Copyright © 2008-2013 The Netty Project. All Rights Reserved.