org.dicom4j.core.utils
Class ArrayCopyUtilities

java.lang.Object
  extended by org.dicom4j.core.utils.ArrayCopyUtilities

public abstract class ArrayCopyUtilities
extends Object

A class of static methods for copying data between arrays of different types, expanding arrays, and comparing them, and removing padding from strings.

Author:
dclunie

Constructor Summary
ArrayCopyUtilities()
           
 
Method Summary
static boolean arraysAreEqual(double[] a1, double[] a2)
          Compare two double arrays and return true if both not null, and are of equal length and contain equal values.
static long[] copySignedIntToLongArray(int[] src)
          Copy an array of signed values in int, into an array of long.
static short[] copySignedIntToShortArray(int[] src)
          Copy an array of signed values in int, into an array of short.
static int[] copySignedShortToIntArray(short[] src)
          Copy an array of signed values in short, into an array of int.
static long[] copySignedShortToLongArray(short[] src)
          Copy an array of signed values in short, into an array of long.
static String[] copyStringArrayRemovingLeadingAndTrailingPadding(String[] src)
          Copy a string removing leading and trailing padding.
static double[] copyStringToDoubleArray(String[] src)
          Extract decimal values from an array of strings into an array of double.
static float[] copyStringToFloatArray(String[] src)
          Extract decimal values from an array of strings into an array of float.
static int[] copyStringToIntArray(String[] src)
          Extract integer values from an array of strings into an array of int.
static long[] copyStringToLongArray(String[] src)
          Extract long values from an array of strings into an array of int.
static long[] copyUnsignedIntToLongArray(int[] src)
          Copy an array of unsigned values in int, into an array of long.
static short[] copyUnsignedIntToShortArray(int[] src)
          Copy an array of unsigned values in int, into an array of short.
static int[] copyUnsignedShortToIntArray(short[] src)
          Copy an array of unsigned values in short, into an array of int.
static long[] copyUnsignedShortToLongArray(short[] src)
          Copy an array of unsigned values in short, into an array of long.
static double[] expandArray(double[] src)
          Expand an array by adding one element to the end.
static double[] expandArray(double[] src, int expandBy)
          Expand an array by adding elements to the end.
static float[] expandArray(float[] src)
          Expand an array by adding one element to the end.
static float[] expandArray(float[] src, int expandBy)
          Expand an array by adding elements to the end.
static int[] expandArray(int[] src)
          Expand an array by adding one element to the end.
static int[] expandArray(int[] src, int expandBy)
          Expand an array by adding elements to the end.
static long[] expandArray(long[] src)
          Expand an array by adding one element to the end.
static long[] expandArray(long[] src, int expandBy)
          Expand an array by adding elements to the end.
static short[] expandArray(short[] src)
          Expand an array by adding one element to the end.
static short[][] expandArray(short[][] src)
          Expand an array by adding one element to the end.
static short[][] expandArray(short[][] src, int expandBy)
          Expand an array by adding elements to the end.
static short[] expandArray(short[] src, int expandBy)
          Expand an array by adding elements to the end.
static String[] expandArray(String[] src)
          Expand an array by adding one element to the end.
static String[] expandArray(String[] src, int expandBy)
          Expand an array by adding elements to the end.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayCopyUtilities

public ArrayCopyUtilities()
Method Detail

copyUnsignedShortToIntArray

public static int[] copyUnsignedShortToIntArray(short[] src)

Copy an array of unsigned values in short, into an array of int.

Sign extension is prevented.

Parameters:
src - an array of short, whose values are interpreted as unsigned
Returns:
an array of int

copySignedShortToIntArray

public static int[] copySignedShortToIntArray(short[] src)

Copy an array of signed values in short, into an array of int.

Sign extension is performed.

Parameters:
src - an array of short, whose values are interpreted as signed
Returns:
an array of int

copyUnsignedShortToLongArray

public static long[] copyUnsignedShortToLongArray(short[] src)

Copy an array of unsigned values in short, into an array of long.

Sign extension is prevented.

Parameters:
src - an array of short, whose values are interpreted as unsigned
Returns:
an array of long

copySignedShortToLongArray

public static long[] copySignedShortToLongArray(short[] src)

Copy an array of signed values in short, into an array of long.

Sign extension is performed.

Parameters:
src - an array of short, whose values are interpreted as signed
Returns:
an array of long

copyUnsignedIntToLongArray

public static long[] copyUnsignedIntToLongArray(int[] src)

Copy an array of unsigned values in int, into an array of long.

Sign extension is prevented.

Parameters:
src - an array of int, whose values are interpreted as unsigned
Returns:
an array of long

copySignedIntToLongArray

public static long[] copySignedIntToLongArray(int[] src)

Copy an array of signed values in int, into an array of long.

Sign extension is performed.

Parameters:
src - an array of int, whose values are interpreted as signed
Returns:
an array of long

copyUnsignedIntToShortArray

public static short[] copyUnsignedIntToShortArray(int[] src)

Copy an array of unsigned values in int, into an array of short.

The value is truncated as necessary.

Parameters:
src - an array of int
Returns:
an array of short

copySignedIntToShortArray

public static short[] copySignedIntToShortArray(int[] src)

Copy an array of signed values in int, into an array of short.

The value is truncated as necessary.

Parameters:
src - an array of int
Returns:
an array of short

copyStringArrayRemovingLeadingAndTrailingPadding

public static String[] copyStringArrayRemovingLeadingAndTrailingPadding(String[] src)

Copy a string removing leading and trailing padding.

Parameters:
src - the padded value
Returns:
the unpadded value

copyStringToIntArray

public static int[] copyStringToIntArray(String[] src)

Extract integer values from an array of strings into an array of int.

Exceptions in the format of the string are trapped and 0 value(s) returned.

Parameters:
src - an array of strings, each of which should be an integer numeric value
Returns:
an array of int

copyStringToLongArray

public static long[] copyStringToLongArray(String[] src)

Extract long values from an array of strings into an array of int.

Exceptions in the format of the string are trapped and 0 value(s) returned.

Parameters:
src - an array of strings, each of which should be an long numeric value
Returns:
an array of long

copyStringToFloatArray

public static float[] copyStringToFloatArray(String[] src)

Extract decimal values from an array of strings into an array of float.

Exceptions in the format of the string are trapped and 0 value(s) returned.

Parameters:
src - an array of strings, each of which should be a decimal numeric value
Returns:
an array of float

copyStringToDoubleArray

public static double[] copyStringToDoubleArray(String[] src)

Extract decimal values from an array of strings into an array of double.

Exceptions in the format of the string are trapped and 0 value(s) returned.

Parameters:
src - an array of strings, each of which should be a decimal numeric value
Returns:
an array of double

expandArray

public static short[] expandArray(short[] src)

Expand an array by adding one element to the end.

Parameters:
src - an array
Returns:
an array that is one element longer

expandArray

public static short[] expandArray(short[] src,
                                  int expandBy)

Expand an array by adding elements to the end.

Parameters:
src - an array
expandBy - the number of elements to add
Returns:
an array that is longer

expandArray

public static short[][] expandArray(short[][] src)

Expand an array by adding one element to the end.

Parameters:
src - an array
Returns:
an array that is one element longer

expandArray

public static short[][] expandArray(short[][] src,
                                    int expandBy)

Expand an array by adding elements to the end.

Parameters:
src - an array
expandBy - the number of elements to add
Returns:
an array that is longer

expandArray

public static int[] expandArray(int[] src)

Expand an array by adding one element to the end.

Parameters:
src - an array
Returns:
an array that is one element longer

expandArray

public static int[] expandArray(int[] src,
                                int expandBy)

Expand an array by adding elements to the end.

Parameters:
src - an array
expandBy - the number of elements to add
Returns:
an array that is longer

expandArray

public static long[] expandArray(long[] src)

Expand an array by adding one element to the end.

Parameters:
src - an array
Returns:
an array that is one element longer

expandArray

public static long[] expandArray(long[] src,
                                 int expandBy)

Expand an array by adding elements to the end.

Parameters:
src - an array
expandBy - the number of elements to add
Returns:
an array that is longer

expandArray

public static float[] expandArray(float[] src)

Expand an array by adding one element to the end.

Parameters:
src - an array
Returns:
an array that is one element longer

expandArray

public static float[] expandArray(float[] src,
                                  int expandBy)

Expand an array by adding elements to the end.

Parameters:
src - an array
expandBy - the number of elements to add
Returns:
an array that is longer

expandArray

public static double[] expandArray(double[] src)

Expand an array by adding one element to the end.

Parameters:
src - an array
Returns:
an array that is one element longer

expandArray

public static double[] expandArray(double[] src,
                                   int expandBy)

Expand an array by adding elements to the end.

Parameters:
src - an array
expandBy - the number of elements to add
Returns:
an array that is longer

expandArray

public static String[] expandArray(String[] src)

Expand an array by adding one element to the end.

Parameters:
src - an array
Returns:
an array that is one element longer

expandArray

public static String[] expandArray(String[] src,
                                   int expandBy)

Expand an array by adding elements to the end.

Parameters:
src - an array
expandBy - the number of elements to add
Returns:
an array that is longer

arraysAreEqual

public static boolean arraysAreEqual(double[] a1,
                                     double[] a2)

Compare two double arrays and return true if both not null, and are of equal length and contain equal values.

Parameters:
a1 -
a2 -
Returns:
true if equal


Copyright © 2009 dicom4j. All Rights Reserved.