Class AWUtil

    • Method Detail

      • safeWrite

        public static <T,​U extends T> int safeWrite​(ArrayWritable<U> aw,
                                                          T[] array)
        Writes the complete container data to an array. This method ensures that the array's capacity is not exceeded.
        Parameters:
        aw - the container.
        array - the array
        Returns:
        the number of elements copied
      • safeWrite

        public static <T,​U extends T> int safeWrite​(int num,
                                                          ArrayWritable<U> aw,
                                                          T[] array)
        Writes a given maximum amount of data items from a container to an array. This method ensures that the array's capacity is not exceeded.
        Parameters:
        num - the number of elements to copy
        aw - the container.
        array - the array
        Returns:
        the number of elements copied
      • safeWrite

        public static <T,​U extends T> int safeWrite​(int num,
                                                          ArrayWritable<U> aw,
                                                          int ofs,
                                                          T[] array,
                                                          int tgtOfs)
      • safeWrite

        public static <T,​U extends T> int safeWrite​(ArrayWritable<U> aw,
                                                          T[] array,
                                                          int tgtOfs)
      • toArray

        public static <T> T[] toArray​(ArrayWritable<?> aw,
                                      T[] arr)