Class NativeTaggedArray


  • public class NativeTaggedArray
    extends java.lang.Object
    A utility class that supports encoding and decoding of arrays of primitive number types to byte arrays such that the characteristics of the number type (float or integer, byte order, element size) and the dimensions are known and can be checked for correctness when converted back to the number type.
    • Constructor Detail

      • NativeTaggedArray

        public NativeTaggedArray()
    • Method Detail

      • tryGetArrayTag

        public static NativeTaggedArray.NativeArrayTag tryGetArrayTag​(byte[] data)
        Returns the array tag of the native tagged array encoded in data, or null, if data does not encode a native tagged array.
      • toByteArray

        public static byte[] toByteArray​(float[] data)
        Converts data into a tagged array in native byte order.
      • toByteArray

        public static byte[] toByteArray​(float[] data,
                                         NativeData.ByteOrder byteOrder)
        Converts data into a tagged array in given byte order.
      • toByteArray

        public static byte[] toByteArray​(MDFloatArray data)
        Converts data into a tagged array in native byte order.
      • tryToFloatArray1D

        public static float[] tryToFloatArray1D​(byte[] data)
        Returns the tagged array data as a float array or null, if data is not a tagged 1D float array.
      • tryToFloatArray

        public static MDFloatArray tryToFloatArray​(byte[] data)
        Returns the tagged array data as a MDFloatArray or null, if data is not a tagged (multi-dimensional) float array.
      • toByteArray

        public static byte[] toByteArray​(double[] data)
        Converts data into a tagged array in native byte order.
      • toByteArray

        public static byte[] toByteArray​(double[] data,
                                         NativeData.ByteOrder byteOrder)
        Converts data into a tagged array in given byte order.
      • toByteArray

        public static byte[] toByteArray​(MDDoubleArray data)
        Converts data into a tagged array in native byte order.
      • tryToDoubleArray1D

        public static double[] tryToDoubleArray1D​(byte[] data)
        Returns the tagged array data as a double array or null, if data is not a tagged 1D double array.
      • tryToDoubleArray

        public static MDDoubleArray tryToDoubleArray​(byte[] data)
        Returns the tagged array data as a MDDoubleArray or null, if data is not a tagged (multi-dimensional) double array.
      • toByteArray

        public static byte[] toByteArray​(short[] data)
        Converts data into a tagged array in native byte order.
      • toByteArray

        public static byte[] toByteArray​(short[] data,
                                         NativeData.ByteOrder byteOrder)
        Converts data into a tagged array in given byte order.
      • toByteArray

        public static byte[] toByteArray​(MDShortArray data)
        Converts data into a tagged array in native byte order.
      • tryToShortArray1D

        public static short[] tryToShortArray1D​(byte[] data)
        Returns the tagged array data as a short array or null, if data is not a tagged 1D short array.
      • tryToShortArray

        public static MDShortArray tryToShortArray​(byte[] data)
        Returns the tagged array data as a MDShortArray or null, if data is not a tagged (multi-dimensional) short array.
      • toByteArray

        public static byte[] toByteArray​(int[] data)
        Converts data into a tagged array in native byte order.
      • toByteArray

        public static byte[] toByteArray​(int[] data,
                                         NativeData.ByteOrder byteOrder)
        Converts data into a tagged array in given byte order.
      • toByteArray

        public static byte[] toByteArray​(MDIntArray data)
        Converts data into a tagged array in native byte order.
      • toByteArray

        public static byte[] toByteArray​(MDIntArray data,
                                         NativeData.ByteOrder byteOrder)
        Converts data into a tagged array in given byte order.
      • tryToIntArray1D

        public static int[] tryToIntArray1D​(byte[] data)
        Returns the tagged array data as an int array or null, if data is not a tagged 1D int array.
      • tryToIntArray

        public static MDIntArray tryToIntArray​(byte[] data)
        Returns the tagged array data as a MDIntArray or null, if data is not a tagged (multi-dimensional) int array.
      • toByteArray

        public static byte[] toByteArray​(long[] data)
        Converts data into a tagged array in native byte order.
      • toByteArray

        public static byte[] toByteArray​(long[] data,
                                         NativeData.ByteOrder byteOrder)
        Converts data into a tagged array in given byte order.
      • toByteArray

        public static byte[] toByteArray​(MDLongArray data)
        Converts data into a tagged array in native byte order.
      • toByteArray

        public static byte[] toByteArray​(MDLongArray data,
                                         NativeData.ByteOrder byteOrder)
        Converts data into a tagged array in given byte order.
      • tryToLongArray1D

        public static long[] tryToLongArray1D​(byte[] data)
        Returns the tagged array data as a long array or null, if data is not a tagged 1D long array.
      • tryToLongArray

        public static MDLongArray tryToLongArray​(byte[] data)
        Returns the tagged array data as a MDLongArray or null, if data is not a tagged (multi-dimensional) long array.