Class IO

java.lang.Object
civitas.celestis.util.IO

public final class IO extends Object
Contains input-output utilities.
  • Method Details

    • readDoubles

      @Nonnull public static double[] readDoubles(@Nonnull String s) throws NumberFormatException
      Reads an array of doubles.
      Parameters:
      s - The string representation of the array
      Returns:
      The parsed array
      Throws:
      NumberFormatException - When the format is invalid
    • readDoubles

      @Nonnull public static <T> T readDoubles(@Nonnull String s, @Nonnull Function<double[],T> constructor) throws NumberFormatException
      Reads an array of doubles into an arbitrary type T.
      Type Parameters:
      T - The type to parse the doubles into
      Parameters:
      s - The string representation of T
      constructor - The constructor to use
      Returns:
      The parsed T
      Throws:
      NumberFormatException - When the format is invalid
    • readFloats

      @Nonnull public static float[] readFloats(@Nonnull String s) throws NumberFormatException
      Reads an array of floats.
      Parameters:
      s - The string representation of the array
      Returns:
      The parsed array
      Throws:
      NumberFormatException - When the format is invalid
    • readFloats

      @Nonnull public static <T> T readFloats(@Nonnull String s, @Nonnull Function<float[],T> constructor) throws NumberFormatException
      Reads an array of floats into an arbitrary type T.
      Type Parameters:
      T - The type to parse the floats into
      Parameters:
      s - The string representation of T
      constructor - The constructor to use
      Returns:
      The parsed T
      Throws:
      NumberFormatException - When the format is invalid
    • readLongs

      @Nonnull public static long[] readLongs(@Nonnull String s) throws NumberFormatException
      Reads an array of longs.
      Parameters:
      s - The string representation of the array
      Returns:
      The parsed array
      Throws:
      NumberFormatException - When the format is invalid
    • readLongs

      @Nonnull public static <T> T readLongs(@Nonnull String s, @Nonnull Function<long[],T> constructor) throws NumberFormatException
      Reads an array of longs into an arbitrary type T.
      Type Parameters:
      T - The type to parse the longs into
      Parameters:
      s - The string representation of T
      constructor - The constructor to use
      Returns:
      The parsed T
      Throws:
      NumberFormatException - When the format is invalid
    • readInts

      @Nonnull public static int[] readInts(@Nonnull String s) throws NumberFormatException
      Reads an array of ints.
      Parameters:
      s - The string representation of the array
      Returns:
      The parsed array
      Throws:
      NumberFormatException - When the format is invalid
    • readInts

      @Nonnull public static <T> T readInts(@Nonnull String s, @Nonnull Function<int[],T> constructor) throws NumberFormatException
      Reads an array of ints into an arbitrary type T.
      Type Parameters:
      T - The type to parse the ints into
      Parameters:
      s - The string representation of T
      constructor - The constructor to use
      Returns:
      The parsed T
      Throws:
      NumberFormatException - When the format is invalid