Package dev.zachmaddox.chunking
Enum Chunking.RemainderPolicy
- All Implemented Interfaces:
Serializable,Comparable<Chunking.RemainderPolicy>
- Enclosing class:
- Chunking
Defines how to handle the trailing remainder when the input size
is not evenly divisible by the chunk size.
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDrop the final chunk if it is smaller thanchunkSize.Fail fast if the input size is not evenly divisible bychunkSize.Include the final partial chunk (default behavior).Pad the final chunk withnullvalues until it reacheschunkSize. -
Method Summary
Modifier and TypeMethodDescriptionstatic Chunking.RemainderPolicyReturns the enum constant of this type with the specified name.static Chunking.RemainderPolicy[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
INCLUDE_PARTIAL
Include the final partial chunk (default behavior). -
DROP_PARTIAL
Drop the final chunk if it is smaller thanchunkSize. -
PAD_WITH_NULLS
Pad the final chunk withnullvalues until it reacheschunkSize.This is primarily useful when consumers require every chunk to have a uniform size and can safely handle
nullvalues inside the chunk. For primitive streams, this policy applies after boxing (for example,IntStreambecomesStream<Integer>). -
ERROR_IF_PARTIAL
Fail fast if the input size is not evenly divisible bychunkSize.An
IllegalStateExceptionis thrown if a trailing partial chunk would be required.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-