Class PrimitiveArrayConversionUtility

java.lang.Object
io.deephaven.integrations.common.PrimitiveArrayConversionUtility

public class PrimitiveArrayConversionUtility extends Object
General purpose helper methods for array conversion methods from specific object types to/from primitive types. This is specifically intended to improve performance in integration with Python, where conversion of primitive type arrays involves direct copy of a memory buffer, and is much more performant than element-by-element inspection.
  • Constructor Details

    • PrimitiveArrayConversionUtility

      public PrimitiveArrayConversionUtility()
  • Method Details

    • translateArrayBooleanToByte

      public static byte[] translateArrayBooleanToByte(Boolean[] array)
      Translates a java.lang.Boolean array to a byte array. The mapping will be performed according to BooleanUtils.booleanAsByte(Boolean). This is the (psuedo)inverse of `translateArrayByteToBoolean`.
      Parameters:
      array - - the Boolean array
      Returns:
      the byte array
    • translateArrayByteToBoolean

      public static Boolean[] translateArrayByteToBoolean(byte[] array)
      Translates a byte array to a Boolean array. The mapping will be performed according to BooleanUtils.byteAsBoolean(byte). This is the (psuedo)inverse of `translateArrayBooleanToByte`.
      Parameters:
      array - - the byte array
      Returns:
      the Boolean array
    • translateArrayInstantToLong

      public static long[] translateArrayInstantToLong(Instant[] array)
      Translates an Instant array to a long array. The mapping will be performed according to DateTimeUtils.epochNanos(Instant). This is the (psuedo)inverse of `translateArrayLongToInstant`.
      Parameters:
      array - - the Instant array
      Returns:
      the corresponding long array
    • translateArrayLongToInstant

      public static Instant[] translateArrayLongToInstant(long[] array)
      Translates a long array to an Instant array. The mapping will be performed according to DateTimeUtils.epochNanosToInstant(long). This is the (psuedo)inverse of `translateArrayLongToInstant`.
      Parameters:
      array - - the long array
      Returns:
      the corresponding Instant array
    • translateArrayStringToInstant

      public static Instant[] translateArrayStringToInstant(String[] array)
      Translates a String array to an Instant array. The mapping will be performed according to DateTimeUtils.parseInstant(String).
      Parameters:
      array - - the string array
      Returns:
      the corresponding Instant array