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.
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(DataBuffer
element to be appended to this list buffer)Overrides java. Implements java. Appends the specified element to the end of this list. |
| public void | add(int
index at which the specified element is to be inserted index, DataBuffer element to be inserted buffer)Overrides java. Implements java. Inserts the specified element at the specified position in this list. |
| public boolean | addAll(Collection<? extends DataBuffer>
collection containing elements to be added to this list collection)Overrides java. Implements java. Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator. |
| public boolean | addAll(int
index at which to insert the first element from the
specified collection index, Collection<? extends DataBuffer> collection containing elements to be added to this list collection)Overrides java. Implements java. Inserts all of the elements in the specified collection into this list, starting at the specified position. |
| public void | clear()
Overrides java. Implements java. Removes all of the elements from this list. |
| private void | |
| public void | |
| public DataBuffer | remove(int
the index of the element to be removed index)Overrides java. Implements java. Removes the element at the specified position in this list. |
| public boolean | remove(Object
element to be removed from this list, if present o)Overrides java. Implements java. Removes the first occurrence of the specified element from this list, if it is present. |
| public boolean | removeAll(Collection<?>
collection containing elements to be removed from this list c)Overrides java. Implements java. Removes from this list all of its elements that are contained in the specified collection. |
| public boolean | removeIf(Predicate<? super DataBuffer>
a predicate which returns filter)true for elements to be
removedOverrides java. Overrides default java. Removes all of the elements of this collection that satisfy the given predicate (optional operation). |
| protected void | removeRange(int
index of first element to be removed fromIndex, int index after last element to be removed toIndex)Overrides java. Removes from this list all of the elements whose index is between
|
| public DataBuffer | set(int
index of the element to replace index, DataBuffer element to be stored at the specified position element)Overrides java. Implements java. Replaces the element at the specified position in this list with the specified element. |
| private void |
| byteCount | back to summary |
|---|---|
| private int byteCount | |
| maxByteCount | back to summary |
|---|---|
| private final int maxByteCount | |
| LimitedDataBufferList | back to summary |
|---|---|
| public LimitedDataBufferList(int maxByteCount) | |
| add | back to summary |
|---|---|
| public boolean add(DataBuffer buffer) Overrides java. Implements java. Doc from java. Appends the specified element to the end of this list.
| |
| add | back to summary |
|---|---|
| public void add(int index, DataBuffer buffer) Overrides java. Implements java. Doc from java. Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
| |
| addAll | back to summary |
|---|---|
| public boolean addAll(Collection<? extends DataBuffer> collection) Overrides java. Implements java. Doc from java. Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this list, and this list is nonempty.)
| |
| addAll | back to summary |
|---|---|
| public boolean addAll(int index, Collection<? extends DataBuffer> collection) Overrides java. Implements java. Doc from java. Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator.
| |
| clear | back to summary |
|---|---|
| public void clear() Overrides java. Implements java. Doc from java. Removes all of the elements from this list. The list will be empty after this call returns.
| |
| raiseLimitException | back to summary |
|---|---|
| private void raiseLimitException() | |
| releaseAndClear | back to summary |
|---|---|
| public void releaseAndClear() | |
| remove | back to summary |
|---|---|
| public DataBuffer remove(int index) Overrides java. Implements java. Doc from java. Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).
| |
| remove | back to summary |
|---|---|
| public boolean remove(Object o) Overrides java. Implements java. Doc from java. Removes the first occurrence of the specified element from this list,
if it is present. If the list does not contain the element, it is
unchanged. More formally, removes the element with the lowest index
| |
| removeAll | back to summary |
|---|---|
| public boolean removeAll(Collection<?> c) Overrides java. Implements java. Doc from java. Removes from this list all of its elements that are contained in the specified collection.
| |
| removeIf | back to summary |
|---|---|
| public boolean removeIf(Predicate<? super DataBuffer> filter) Overrides java. Overrides default java. Doc from java. Removes all of the elements of this collection that satisfy the given predicate (optional operation). Errors or runtime exceptions thrown during iteration or by the predicate are relayed to the caller.
| |
| removeRange | back to summary |
|---|---|
| protected void removeRange(int fromIndex, int toIndex) Overrides java. Doc from java. Removes from this list all of the elements whose index is between
| |
| set | back to summary |
|---|---|
| public DataBuffer set(int index, DataBuffer element) Overrides java. Implements java. Doc from java. Replaces the element at the specified position in this list with the specified element.
| |
| updateCount | back to summary |
|---|---|
| private void updateCount(int bytesToAdd) | |