Class LimitedDataBufferList
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<DataBuffer>,Collection<DataBuffer>,List<DataBuffer>,RandomAccess
Custom
List to collect data buffers with and enforce a
limit on the total number of bytes buffered. For use with "collect" or
other buffering operators in declarative APIs, e.g. Flux.
Adding elements increases the byte count and if the limit is exceeded,
DataBufferLimitException is raised. clear() resets the
count. Remove and set are not supported.
Note: This class does not automatically release the
buffers it contains. It is usually preferable to use hooks such as
Flux.doOnDiscard(java.lang.Class<R>, java.util.function.Consumer<? super R>) that also take care of cancel and error signals,
or otherwise releaseAndClear() can be used.
- Since:
- 5.1.11
- Author:
- Rossen Stoyanchev
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int index, DataBuffer buffer) booleanadd(DataBuffer buffer) booleanaddAll(int index, Collection<? extends DataBuffer> collection) booleanaddAll(Collection<? extends DataBuffer> collection) voidclear()voidremove(int index) booleanbooleanremoveAll(Collection<?> c) booleanremoveIf(Predicate<? super DataBuffer> filter) protected voidremoveRange(int fromIndex, int toIndex) set(int index, DataBuffer element) Methods inherited from class java.util.ArrayList
clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Constructor Details
-
LimitedDataBufferList
public LimitedDataBufferList(int maxByteCount)
-
-
Method Details
-
add
- Specified by:
addin interfaceCollection<DataBuffer>- Specified by:
addin interfaceList<DataBuffer>- Overrides:
addin classArrayList<DataBuffer>
-
add
- Specified by:
addin interfaceList<DataBuffer>- Overrides:
addin classArrayList<DataBuffer>
-
addAll
- Specified by:
addAllin interfaceCollection<DataBuffer>- Specified by:
addAllin interfaceList<DataBuffer>- Overrides:
addAllin classArrayList<DataBuffer>
-
addAll
- Specified by:
addAllin interfaceList<DataBuffer>- Overrides:
addAllin classArrayList<DataBuffer>
-
remove
- Specified by:
removein interfaceList<DataBuffer>- Overrides:
removein classArrayList<DataBuffer>
-
remove
- Specified by:
removein interfaceCollection<DataBuffer>- Specified by:
removein interfaceList<DataBuffer>- Overrides:
removein classArrayList<DataBuffer>
-
removeRange
protected void removeRange(int fromIndex, int toIndex) - Overrides:
removeRangein classArrayList<DataBuffer>
-
removeAll
- Specified by:
removeAllin interfaceCollection<DataBuffer>- Specified by:
removeAllin interfaceList<DataBuffer>- Overrides:
removeAllin classArrayList<DataBuffer>
-
removeIf
- Specified by:
removeIfin interfaceCollection<DataBuffer>- Overrides:
removeIfin classArrayList<DataBuffer>
-
set
- Specified by:
setin interfaceList<DataBuffer>- Overrides:
setin classArrayList<DataBuffer>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<DataBuffer>- Specified by:
clearin interfaceList<DataBuffer>- Overrides:
clearin classArrayList<DataBuffer>
-
releaseAndClear
public void releaseAndClear()
-