Package io.netty.handler.codec
Class CodecOutputList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<java.lang.Object>
-
- io.netty.handler.codec.CodecOutputList
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Object>,java.util.Collection<java.lang.Object>,java.util.List<java.lang.Object>,java.util.RandomAccess
final class CodecOutputList extends java.util.AbstractList<java.lang.Object> implements java.util.RandomAccessSpecialAbstractListimplementation which is used within our codec base classes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static interfaceCodecOutputList.CodecOutputListRecyclerprivate static classCodecOutputList.CodecOutputLists
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object[]arrayprivate static FastThreadLocal<CodecOutputList.CodecOutputLists>CODEC_OUTPUT_LISTS_POOLprivate booleaninsertSinceRecycledprivate static CodecOutputList.CodecOutputListRecyclerNOOP_RECYCLERprivate CodecOutputList.CodecOutputListRecyclerrecyclerprivate intsize
-
Constructor Summary
Constructors Modifier Constructor Description privateCodecOutputList(CodecOutputList.CodecOutputListRecycler recycler, int size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, java.lang.Object element)booleanadd(java.lang.Object element)private voidcheckIndex(int index)voidclear()private voidexpandArray()java.lang.Objectget(int index)(package private) java.lang.ObjectgetUnsafe(int index)Returns the element on the given index.private voidinsert(int index, java.lang.Object element)(package private) booleaninsertSinceRecycled()Returnstrueif any elements where added or set.(package private) static CodecOutputListnewInstance()(package private) voidrecycle()Recycle the array which will clear it and null out all entries in the internal storage.java.lang.Objectremove(int index)java.lang.Objectset(int index, java.lang.Object element)intsize()-
Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
-
-
-
Field Detail
-
NOOP_RECYCLER
private static final CodecOutputList.CodecOutputListRecycler NOOP_RECYCLER
-
CODEC_OUTPUT_LISTS_POOL
private static final FastThreadLocal<CodecOutputList.CodecOutputLists> CODEC_OUTPUT_LISTS_POOL
-
recycler
private final CodecOutputList.CodecOutputListRecycler recycler
-
size
private int size
-
array
private java.lang.Object[] array
-
insertSinceRecycled
private boolean insertSinceRecycled
-
-
Constructor Detail
-
CodecOutputList
private CodecOutputList(CodecOutputList.CodecOutputListRecycler recycler, int size)
-
-
Method Detail
-
newInstance
static CodecOutputList newInstance()
-
get
public java.lang.Object get(int index)
- Specified by:
getin interfacejava.util.List<java.lang.Object>- Specified by:
getin classjava.util.AbstractList<java.lang.Object>
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<java.lang.Object>- Specified by:
sizein interfacejava.util.List<java.lang.Object>- Specified by:
sizein classjava.util.AbstractCollection<java.lang.Object>
-
add
public boolean add(java.lang.Object element)
- Specified by:
addin interfacejava.util.Collection<java.lang.Object>- Specified by:
addin interfacejava.util.List<java.lang.Object>- Overrides:
addin classjava.util.AbstractList<java.lang.Object>
-
set
public java.lang.Object set(int index, java.lang.Object element)- Specified by:
setin interfacejava.util.List<java.lang.Object>- Overrides:
setin classjava.util.AbstractList<java.lang.Object>
-
add
public void add(int index, java.lang.Object element)- Specified by:
addin interfacejava.util.List<java.lang.Object>- Overrides:
addin classjava.util.AbstractList<java.lang.Object>
-
remove
public java.lang.Object remove(int index)
- Specified by:
removein interfacejava.util.List<java.lang.Object>- Overrides:
removein classjava.util.AbstractList<java.lang.Object>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<java.lang.Object>- Specified by:
clearin interfacejava.util.List<java.lang.Object>- Overrides:
clearin classjava.util.AbstractList<java.lang.Object>
-
insertSinceRecycled
boolean insertSinceRecycled()
Returnstrueif any elements where added or set. This will be reset oncerecycle()was called.
-
recycle
void recycle()
Recycle the array which will clear it and null out all entries in the internal storage.
-
getUnsafe
java.lang.Object getUnsafe(int index)
Returns the element on the given index. This operation will not do any range-checks and so is considered unsafe.
-
checkIndex
private void checkIndex(int index)
-
insert
private void insert(int index, java.lang.Object element)
-
expandArray
private void expandArray()
-
-