public class ByteBufferHolder extends Object implements IByteBufferHolder, List<ByteBuffer>
Constructor and Description |
---|
ByteBufferHolder()
Constructs an empty byte buffer holder with an initial capacity of ten.
|
ByteBufferHolder(Collection<ByteBuffer> c)
Constructs a byte buffer holder containing the byte buffers of the specified
collection, in the order they are returned by the collection's iterator.
|
ByteBufferHolder(int initialCapacity)
Constructs an empty byte buffer holder with the specified initial capacity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(ByteBuffer e) |
void |
add(int index,
ByteBuffer element) |
boolean |
addAll(Collection<? extends ByteBuffer> c) |
boolean |
addAll(int index,
Collection<? extends ByteBuffer> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
ByteBuffer |
get(int index) |
boolean |
hasRemaining()
Tells whether there are any bytes remaining in byte buffers stored in this
holder.
|
int |
indexOf(Object o) |
boolean |
isEmpty() |
boolean |
isMessage()
Tells if this byte buffer holder should be treated as a message or raw bytes
when it is processed thru an encoding pipeline.
|
Iterator<ByteBuffer> |
iterator() |
int |
lastIndexOf(Object o) |
ListIterator<ByteBuffer> |
listIterator() |
ListIterator<ByteBuffer> |
listIterator(int index) |
int |
remaining()
Returns the total number of bytes remaining in all byte buffers stored in
this holder.
|
ByteBuffer |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
ByteBuffer |
set(int index,
ByteBuffer element) |
int |
size() |
List<ByteBuffer> |
subList(int fromIndex,
int toIndex) |
ByteBuffer[] |
toArray()
Returns an array containing all of byte buffers stored in this holder in
proper sequence (from first to last buffer buffer to send).
|
<T> T[] |
toArray(T[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode, replaceAll, sort, spliterator
parallelStream, removeIf, stream
public ByteBufferHolder()
public ByteBufferHolder(int initialCapacity)
initialCapacity
- the initial capacitypublic ByteBufferHolder(Collection<ByteBuffer> c)
c
- the collection whose byte buffers are to be placed into this byte
buffer holderpublic boolean hasRemaining()
IByteBufferHolder
hasRemaining
in interface IByteBufferHolder
true
if, and only if, there is at least one byte remaining in
byte buffers stored in this holderpublic int remaining()
IByteBufferHolder
remaining
in interface IByteBufferHolder
public ByteBuffer[] toArray()
IByteBufferHolder
The returned array should be "safe" in that no references to it are maintained by this holder. (In other words, this method must allocate a new array). The caller is thus free to modify the returned array.
toArray
in interface Collection<ByteBuffer>
toArray
in interface List<ByteBuffer>
toArray
in interface IByteBufferHolder
public boolean isMessage()
When true
is returned the processing will start from the last encoder
in the pipeline with inbound type matching a class implementing this
interface or this interface itself.
In other case, when false
is returned, the processing will start from
the last encoder with inbound type that is either byte[]
,
ByteBuffer
or this interface itself.
isMessage
in interface IByteBufferHolder
false
public int size()
size
in interface Collection<ByteBuffer>
size
in interface List<ByteBuffer>
public boolean isEmpty()
isEmpty
in interface Collection<ByteBuffer>
isEmpty
in interface List<ByteBuffer>
public boolean contains(Object o)
contains
in interface Collection<ByteBuffer>
contains
in interface List<ByteBuffer>
public Iterator<ByteBuffer> iterator()
iterator
in interface Iterable<ByteBuffer>
iterator
in interface Collection<ByteBuffer>
iterator
in interface List<ByteBuffer>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<ByteBuffer>
toArray
in interface List<ByteBuffer>
public boolean add(ByteBuffer e)
add
in interface Collection<ByteBuffer>
add
in interface List<ByteBuffer>
public boolean remove(Object o)
remove
in interface Collection<ByteBuffer>
remove
in interface List<ByteBuffer>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<ByteBuffer>
containsAll
in interface List<ByteBuffer>
public boolean addAll(Collection<? extends ByteBuffer> c)
addAll
in interface Collection<ByteBuffer>
addAll
in interface List<ByteBuffer>
public boolean addAll(int index, Collection<? extends ByteBuffer> c)
addAll
in interface List<ByteBuffer>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<ByteBuffer>
removeAll
in interface List<ByteBuffer>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<ByteBuffer>
retainAll
in interface List<ByteBuffer>
public void clear()
clear
in interface Collection<ByteBuffer>
clear
in interface List<ByteBuffer>
public ByteBuffer get(int index)
get
in interface List<ByteBuffer>
public ByteBuffer set(int index, ByteBuffer element)
set
in interface List<ByteBuffer>
public void add(int index, ByteBuffer element)
add
in interface List<ByteBuffer>
public ByteBuffer remove(int index)
remove
in interface List<ByteBuffer>
public int indexOf(Object o)
indexOf
in interface List<ByteBuffer>
public int lastIndexOf(Object o)
lastIndexOf
in interface List<ByteBuffer>
public ListIterator<ByteBuffer> listIterator()
listIterator
in interface List<ByteBuffer>
public ListIterator<ByteBuffer> listIterator(int index)
listIterator
in interface List<ByteBuffer>
public List<ByteBuffer> subList(int fromIndex, int toIndex)
subList
in interface List<ByteBuffer>
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.