Package com.igormaznitsa.jbbp.io
Interface JBBPArraySizeLimiter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Interface describing an object which provides limit to read array items.
- Since:
- 2.1.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintGet allowed size of array to read.static booleanisBreakReadWholeStream(int readItems, JBBPArraySizeLimiter limiter) Check number of read items for whole stream array and return flag if read should be stopped or throw exception if required.
-
Field Details
-
NO_LIMIT_FOR_ARRAY_SIZE
Read arrays without limits.
-
-
Method Details
-
isBreakReadWholeStream
Check number of read items for whole stream array and return flag if read should be stopped or throw exception if required.- Parameters:
readItems- number of currently read array itemslimiter- limiter provides number of allowed items, must not be null- Returns:
- true if read must be stopped immediately, false otherwise
- Throws:
JBBPReachedArraySizeLimitException- it will be thrown if reach of limit is not allowed
-
getArrayItemsLimit
int getArrayItemsLimit()Get allowed size of array to read.- Returns:
- 0 means no limit, positive value means allowed number of items with exception throwing if read more items, negative value means number of read values and stop read if exceeded.
-