public final class BufferStrategies
extends java.lang.Object
BufferStrategy
instances.Modifier and Type | Method and Description |
---|---|
static <T> BufferStrategy<T,BufferStrategy.Accumulator<T,java.lang.Iterable<T>>,java.lang.Iterable<T>> |
forCountOrTime(int count,
java.time.Duration duration)
Returns a
BufferStrategy that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started. |
static <T> BufferStrategy<T,BufferStrategy.Accumulator<T,java.lang.Iterable<T>>,java.lang.Iterable<T>> |
forCountOrTime(int count,
java.time.Duration duration,
Executor executor)
Returns a
BufferStrategy that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started. |
static <T,BC extends BufferStrategy.Accumulator<T,B>,B> |
forCountOrTime(int count,
java.time.Duration duration,
java.util.function.Supplier<BC> accumulatorSupplier)
Returns a
BufferStrategy that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started. |
static <T,BC extends BufferStrategy.Accumulator<T,B>,B> |
forCountOrTime(int count,
java.time.Duration duration,
java.util.function.Supplier<BC> accumulatorSupplier,
Executor executor)
Returns a
BufferStrategy that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started. |
public static <T> BufferStrategy<T,BufferStrategy.Accumulator<T,java.lang.Iterable<T>>,java.lang.Iterable<T>> forCountOrTime(int count, java.time.Duration duration)
BufferStrategy
that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started. This does not guarantee that the emitted buffers after applying the
returned BufferStrategy
will have exactly count
number of items. The emitted buffers may have
less or more items than the count
.T
- Type of items added to the buffer.count
- Number of items to add before closing the current buffer boundary, if not already closed. The
emitted buffers may have less or more items than this count
.duration
- Duration
after which the current buffer boundary is closed, if not already closed.BufferStrategy
that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started.public static <T> BufferStrategy<T,BufferStrategy.Accumulator<T,java.lang.Iterable<T>>,java.lang.Iterable<T>> forCountOrTime(int count, java.time.Duration duration, Executor executor)
BufferStrategy
that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started. This does not guarantee that the emitted buffers after applying the
returned BufferStrategy
will have exactly count
number of items. The emitted buffers may have
less or more items than the count
.T
- Type of items added to the buffer.count
- Number of items to add before closing the current buffer boundary, if not already closed.duration
- Duration
after which the current buffer boundary is closed, if not already closed.executor
- Executor
to use for recording the passed duration
.BufferStrategy
that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started.public static <T,BC extends BufferStrategy.Accumulator<T,B>,B> BufferStrategy<T,BufferStrategy.Accumulator<T,B>,B> forCountOrTime(int count, java.time.Duration duration, java.util.function.Supplier<BC> accumulatorSupplier)
BufferStrategy
that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started. This does not guarantee that the emitted buffers after applying the
returned BufferStrategy
will have exactly count
number of items. The emitted buffers may have
less or more items than the count
.T
- Type of items added to the buffer.BC
- Type of BufferStrategy.Accumulator
used to accumulate items in a buffer.B
- Type of object created after an BufferStrategy.Accumulator
is finished
.count
- Number of items to add before closing the current buffer boundary, if not already closed.duration
- Duration
after which the current buffer boundary is closed, if not already closed.accumulatorSupplier
- A Supplier
of BufferStrategy.Accumulator
every time a buffer boundary is closed.
Methods on the BufferStrategy.Accumulator
returned from this Supplier
may or may not be called.BufferStrategy
that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started.public static <T,BC extends BufferStrategy.Accumulator<T,B>,B> BufferStrategy<T,BufferStrategy.Accumulator<T,B>,B> forCountOrTime(int count, java.time.Duration duration, java.util.function.Supplier<BC> accumulatorSupplier, Executor executor)
BufferStrategy
that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started. This does not guarantee that the emitted buffers after applying the
returned BufferStrategy
will have exactly count
number of items. The emitted buffers may have
less or more items than the count
.T
- Type of items added to the buffer.BC
- Type of BufferStrategy.Accumulator
used to accumulate items in a buffer.B
- Type of object created after an BufferStrategy.Accumulator
is finished
.count
- Number of items to add before closing the current buffer boundary, if not already closed.duration
- Duration
after which the current buffer boundary is closed, if not already closed.accumulatorSupplier
- A Supplier
of BufferStrategy.Accumulator
every time a buffer boundary is closed.
Methods on the BufferStrategy.Accumulator
returned from this Supplier
may or may not be called.executor
- Executor
to use for recording the passed duration
.BufferStrategy
that creates buffer boundaries based on number of items buffered or time elapsed
since the current buffer boundary started.