Package org.apache.poi.util
Class ArrayUtil
java.lang.Object
org.apache.poi.util.ArrayUtil
Utility classes for dealing with arrays.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidarrayMoveWithin(Object[] array, int moveFrom, int moveTo, int numToMove) Moves a number of entries in an array to another point in the array, shifting those inbetween as required.static voidsafelyAllocateCheck(long length, int maxLength, String limitMethod) This method is targeted at doing length checks for generic array creations.static voidstrictAllocateCheck(long length, int maxLength)
-
Method Details
-
arrayMoveWithin
Moves a number of entries in an array to another point in the array, shifting those inbetween as required.- Parameters:
array- The array to altermoveFrom- The (0 based) index of the first entry to movemoveTo- The (0 based) index of the positition to move tonumToMove- The number of entries to move
-
safelyAllocateCheck
This method is targeted at doing length checks for generic array creations.IOUtils.safelyAllocateCheck(long, int, String)is aimed at byte array based checks (or equivalents streams of bytes). Arrays of object instances will take up a lot more memory than the same number of bytes. So the limits applied in ArrayUtil are intended to be a lot lower than the IOUtil ones.- Parameters:
length-maxLength-limitMethod- name of method that can be used to change the limit- Throws:
RecordFormatException- if the length is negative or too long
-
strictAllocateCheck
public static void strictAllocateCheck(long length, int maxLength)
-