Class ArrayUtil

java.lang.Object
org.apache.poi.util.ArrayUtil

@Internal public final class ArrayUtil extends Object
Utility classes for dealing with arrays.
  • Method Details

    • arrayMoveWithin

      public static void arrayMoveWithin(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.
      Parameters:
      array - The array to alter
      moveFrom - The (0 based) index of the first entry to move
      moveTo - The (0 based) index of the positition to move to
      numToMove - The number of entries to move
    • safelyAllocateCheck

      public static void safelyAllocateCheck(long length, int maxLength, String limitMethod)
      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)