Class LevelBytePool
java.lang.Object
de.tomatengames.util.pool.LevelBytePool
- All Implemented Interfaces:
BytePool
The
LevelBytePool class provides a pool of byte arrays, allowing efficient
management and reuse of byte arrays with varying lengths. It uses multiple
LinkedPool instances to manage arrays of different sizes.- Since:
- 1.8
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newLevelBytePoolinstance with pre-configured pools for byte arrays of different sizes. -
Method Summary
Modifier and TypeMethodDescriptionPooled<byte[]> claim(int minLength) Claims a byte array that is at least as long as the specified minimum length.voidclean()Cleans all pools by reducing their sizes to the minimum size recorded since the last clean operation.Pool<byte[]> ofLength(int minLength) Returns a pool that provides byte arrays that are at least as long as the specified minimum length.
-
Constructor Details
-
LevelBytePool
public LevelBytePool()Constructs a newLevelBytePoolinstance with pre-configured pools for byte arrays of different sizes.
-
-
Method Details
-
clean
public void clean()Cleans all pools by reducing their sizes to the minimum size recorded since the last clean operation.Call this regularly for active cleaning.
-
ofLength
Description copied from interface:BytePoolReturns a pool that provides byte arrays that are at least as long as the specified minimum length. -
claim
Description copied from interface:BytePoolClaims a byte array that is at least as long as the specified minimum length.
-