Additional top-level class in compilation unit: DisabledBuffer.
Beware that it is the responsibility of the caller to ensure that a consumer has exclusive read access to the buffer. This implementation does not include fail-fast behavior to guard against incorrect consumer usage.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| public static final int | |
| public static final int |
| Modifier and Type | Method and Description |
|---|---|
| public static <E> Buffer | |
| public void | |
| public int | Returns: Buffer.SUCCESS, Buffer.FAILED, or Buffer.FULLthe element to add e)Inserts the specified element into this buffer if it is possible to do so immediately without violating capacity restrictions. |
| public long | Returns: the number of elements read from this bufferReturns the number of elements that have been read from the buffer. |
| public default long | Returns: the number of elements in this bufferReturns the number of elements residing in the buffer. |
| public long | Returns: the number of elements written to this bufferReturns the number of elements that have been written to the buffer. |
| FAILED | back to summary |
|---|---|
| public static final int FAILED | |
| FULL | back to summary |
|---|---|
| public static final int FULL | |
| SUCCESS | back to summary |
|---|---|
| public static final int SUCCESS | |
| disabled | back to summary |
|---|---|
| public static <E> Buffer Returns a no-op implementation.
| |
| drainTo | back to summary |
|---|---|
| public void drainTo(Consumer<E> consumer) Drains the buffer, sending each element to the consumer for processing. The caller must ensure that a consumer has exclusive read access to the buffer.
| |
| offer | back to summary |
|---|---|
| public int offer(E e) Inserts the specified element into this buffer if it is possible to do so immediately without violating capacity restrictions. The addition is allowed to fail spuriously if multiple threads insert concurrently.
| |
| reads | back to summary |
|---|---|
| public long reads() Returns the number of elements that have been read from the buffer.
| |
| size | back to summary |
|---|---|
| public default long size() Returns the number of elements residing in the buffer.
| |
| writes | back to summary |
|---|---|
| public long writes() Returns the number of elements that have been written to the buffer.
| |