- 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
that also take care of cancel
and error signals, or otherwise releaseAndClear()
can be used.
- Since:
- 5.1.11
- Author:
- Rossen Stoyanchev
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int index, DataBuffer buffer) boolean
add
(DataBuffer buffer) boolean
addAll
(int index, Collection<? extends DataBuffer> collection) boolean
addAll
(Collection<? extends DataBuffer> collection) void
clear()
void
remove
(int index) boolean
boolean
removeAll
(Collection<?> c) boolean
removeIf
(Predicate<? super DataBuffer> filter) 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, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll
-
Constructor Details
-
LimitedDataBufferList
public LimitedDataBufferList(int maxByteCount)
-
-
Method Details
-
add
- Specified by:
add
in interfaceCollection<DataBuffer>
- Specified by:
add
in interfaceList<DataBuffer>
- Overrides:
add
in classArrayList<DataBuffer>
-
add
- Specified by:
add
in interfaceList<DataBuffer>
- Overrides:
add
in classArrayList<DataBuffer>
-
addAll
- Specified by:
addAll
in interfaceCollection<DataBuffer>
- Specified by:
addAll
in interfaceList<DataBuffer>
- Overrides:
addAll
in classArrayList<DataBuffer>
-
addAll
- Specified by:
addAll
in interfaceList<DataBuffer>
- Overrides:
addAll
in classArrayList<DataBuffer>
-
remove
- Specified by:
remove
in interfaceList<DataBuffer>
- Overrides:
remove
in classArrayList<DataBuffer>
-
remove
- Specified by:
remove
in interfaceCollection<DataBuffer>
- Specified by:
remove
in interfaceList<DataBuffer>
- Overrides:
remove
in classArrayList<DataBuffer>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<DataBuffer>
- Specified by:
removeAll
in interfaceList<DataBuffer>
- Overrides:
removeAll
in classArrayList<DataBuffer>
-
removeIf
- Specified by:
removeIf
in interfaceCollection<DataBuffer>
- Overrides:
removeIf
in classArrayList<DataBuffer>
-
set
- Specified by:
set
in interfaceList<DataBuffer>
- Overrides:
set
in classArrayList<DataBuffer>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<DataBuffer>
- Specified by:
clear
in interfaceList<DataBuffer>
- Overrides:
clear
in classArrayList<DataBuffer>
-
releaseAndClear
public void releaseAndClear()
-