Class CLInput

java.lang.Object
io.github.darvil.lanat.CLInput

public final class CLInput extends Object
A class to gather the input from the command line.
  • Field Details

    • args

      @NotNull public final @NotNull String args
      The string of arguments passed to the program.
  • Method Details

    • from

      @NotNull public static @NotNull CLInput from(@NotNull @NotNull String @NotNull [] args)
      Constructs a new CLInput from the given arguments array.
      Parameters:
      args - The array of arguments.
      Returns:
      A new CLInput from the given arguments array.
    • from

      @NotNull public static @NotNull CLInput from(@NotNull @NotNull String args)
      Constructs a new CLInput from the given arguments string.
      Parameters:
      args - The arguments string.
      Returns:
      A new CLInput from the given arguments string.
    • fromSystemProperty

      @NotNull public static @NotNull CLInput fromSystemProperty()
      Gets the arguments passed to the program from the system property "sun.java.command".
      Returns:
      A new CLInput from the system property "sun.java.command".
    • fromFile

      @NotNull public static @NotNull CLInput fromFile(@NotNull @NotNull File file)
      Constructs a new CLInput from the given file. The input will be the contents of the file. If the file does not exist, the input will be an empty string.
      Parameters:
      file - The file to read the input from.
      Returns:
      A new CLInput from the given file.
    • fromStandardInput

      @NotNull public static @NotNull CLInput fromStandardInput()
      Constructs a new CLInput from the standard input. The input will be the first line read.
      Returns:
      A new CLInput from the standard input.
    • isEmpty

      public boolean isEmpty()
      Returns true if no arguments were passed to the program.