Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.util
Class ArrayUtil

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

    public class ArrayUtil

extends java.lang.Object

Utility classes for dealing with arrays.

Author:
  Glen Stampoultzis

Constructor Summary
`ArrayUtil()`

Method Summary
`static void` | `arraycopy(byte[] src, int src_position, byte[] dst, int dst_position, int length)` This is really a debugging version of `System.arraycopy()`.
`static void` | `arrayMoveWithin(java.lang.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 byte[]` | `copyOf(byte[] source, int newLength)` Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.
`static byte[]` | `copyOfRange(byte[] original, int from, int to)` Copies the specified range of the specified array into a new array.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ArrayUtil

    public ArrayUtil()

Method Detail

### arraycopy

    public static void arraycopy(byte[] src,
                                 int src_position,
                                 byte[] dst,
                                 int dst_position,
                                 int length)

  This is really a debugging version of `System.arraycopy()`. Use it to provide better exception messages when copying arrays around. For production use it's better to use the original for speed.

### arrayMoveWithin

    public static void arrayMoveWithin(java.lang.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

### copyOf

    public static byte[] copyOf(byte[] source,
                                int newLength)

  Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. This method is temporary replace for Arrays.copyOf() until we start to require JDK 1.6.

  Parameters:
    `source` - the array to be copied
    `newLength` - the length of the copy to be returned
  Returns:
    a copy of the original array, truncated or padded with zeros to obtain the specified length
  Throws:
    `java.lang.NegativeArraySizeException` - if `newLength` is negative
    `java.lang.NullPointerException` - if `original` is null

### copyOfRange

    public static byte[] copyOfRange(byte[] original,
                                     int from,
                                     int to)

  Copies the specified range of the specified array into a new array. The initial index of the range (`from`) must lie between zero and `original.length`, inclusive. The value at `original[from]` is placed into the initial element of the copy (unless `from == original.length` or `from == to`). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (`to`), which must be greater than or equal to `from`, may be greater than `original.length`, in which case `(byte)0` is placed in all elements of the copy whose index is greater than or equal to `original.length - from`. The length of the returned array will be `to - from`. This method is temporary replace for Arrays.copyOfRange() until we start to require JDK 1.6.

  Parameters:
    `original` - the array from which a range is to be copied
    `from` - the initial index of the range to be copied, inclusive
    `to` - the final index of the range to be copied, exclusive. (This index may lie outside the array.)
  Returns:
    a new array containing the specified range from the original array, truncated or padded with zeros to obtain the required length
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if `from < 0` or `from > original.length()`
    `java.lang.IllegalArgumentException` - if `from > to`
    `java.lang.NullPointerException` - if `original` is null
  Since:
    1.6

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD