Class IoOptions

java.lang.Object
com.dua3.utility.io.IoOptions

public final class IoOptions extends Object
Helper class defining some common Option instances that can be used for command line parsing.
  • Field Details

    • OPTION_CHARSET

      public static final Option<Charset> OPTION_CHARSET
      Represents an option for specifying the character encoding to be used in various text-based operations. This option allows users to define a custom character encoding, and defaults to UTF-8 if no encoding is specified.
    • OPTION_DATE_TIME_FORMAT

      public static final Option<PredefinedDateTimeFormat> OPTION_DATE_TIME_FORMAT
      Represents an option for specifying the date and time format to be used in various operations. This option allows the user to select a predefined date and time format, enabling consistent parsing or formatting of date-time values.

      The default value for this option is PredefinedDateTimeFormat.ISO_DATE_TIME, which supports the ISO-8601 date-time format.

    • OPTION_FIELD_SEPARATOR

      public static final Option<Character> OPTION_FIELD_SEPARATOR
      Defines an option for specifying the field separator character. This option allows customization of the character used to separate fields within the same row during data processing, such as in CSV files.

      The default field separator is provided by a Supplier that specifies a default value, which is a comma (`,`).

      This option can be used to align the field separator configuration with the data formatting requirements of specific use cases.

    • OPTION_TEXT_DELIMITER

      public static final Option<Character> OPTION_TEXT_DELIMITER
      Represents an optional configuration for specifying the character used as a text delimiter in input or output operations. This option is typically used to define the character that delimits quoted text, such as when handling CSV or similar structured text formats.

      By default, the text delimiter is set to the double-quote character (`"`).

      The textDelimiter method is used to initialize this option with a default character, supplied through a Supplier<Character>.

      This option allows flexibility by enabling customization of the quoted text delimiter to suit various input or output data formats.

    • OPTION_INPUT

      public static final Option<Path> OPTION_INPUT
      A predefined constant representing the input path option. This option allows the user to specify the path to the input data. The default path is determined by the provided supplier, which can return null.
      See Also:
    • OPTION_OUTPUT

      public static final Option<Path> OPTION_OUTPUT
      An option for specifying the output path. This option allows users to define the path where the output data will be written.

      The option is created using a default Supplier that can provide a default output path if none is explicitly specified.

      The provided Supplier for the default value returns null by default, indicating that no output path is specified unless explicitly set.

    • OPTION_LOCALE

      public static final Option<Locale> OPTION_LOCALE
      Represents an option for specifying the Locale to be used in various operations. This option allows configuring regional settings, such as language and formatting conventions, applicable for tasks like reading or writing files.

      The default locale is provided by invoking the Locale::getDefault method, which retrieves the system's default locale settings.

      Use this option when a specific locale must be set or when the default system locale suffices.

  • Method Details

    • charset

      public static Option<Charset> charset(Supplier<Charset> defaultSupplier)
      Creates an option for character encoding selection. This method defines a customizable option that allows the user to specify a character encoding from the available system character sets.
      Parameters:
      defaultSupplier - a Supplier that provides the default character encoding if none is specified
      Returns:
      an Option<Charset> representing the character encoding selection
    • locale

      public static Option<Locale> locale(Supplier<Locale> defaultSupplier)
      Creates an option for selecting the locale. This option allows specifying the locale to be used when performing operations such as reading or writing files. The locale defines regional settings such as language and formatting conventions.
      Parameters:
      defaultSupplier - a Supplier that provides the default locale if none is explicitly specified
      Returns:
      an Option<Locale> representing the locale selection
    • input

      public static Option<Path> input(Supplier<@Nullable Path> defaultSupplier)
      Creates an option for specifying the input path. This option allows the user to define the path where the input data is located.
      Parameters:
      defaultSupplier - a Supplier that provides the default input path if none is explicitly specified. The supplied path can be null.
      Returns:
      an Option<Path> representing the input path option.
    • output

      public static Option<Path> output(Supplier<@Nullable Path> defaultSupplier)
      Creates an option for specifying the output path. This option allows the user to define the path where the output data will be written.
      Parameters:
      defaultSupplier - a Supplier that provides the default output path if none is explicitly specified. The supplied path can be null.
      Returns:
      an Option<Path> representing the output path option.
    • textDelimiter

      public static Option<Character> textDelimiter(Supplier<Character> defaultSupplier)
      Creates an option for specifying the text delimiter for quoted texts. This option allows the user to define the character used as a text delimiter when handling quoted text in input or output operations.
      Parameters:
      defaultSupplier - a Supplier that provides the default text delimiter if none is explicitly specified
      Returns:
      an Option<Character> representing the text delimiter option
    • fieldSeparator

      public static Option<Character> fieldSeparator(Supplier<Character> defaultSupplier)
      Creates an option for specifying the field separator character. This option allows the user to define the character used to separate fields within the same row of data.
      Parameters:
      defaultSupplier - a Supplier<Character> that provides the default field separator character if none is explicitly specified
      Returns:
      an Option<Character> representing the field separator option
    • dateFormat

      public static Option<PredefinedDateTimeFormat> dateFormat(Supplier<PredefinedDateTimeFormat> defaultSupplier)
      Creates an option for specifying the date format to be used in various operations. This method allows the user to select a predefined date and time format.
      Parameters:
      defaultSupplier - a Supplier that provides the default date format if none is explicitly specified
      Returns:
      an Option<PredefinedDateTimeFormat> representing the configurable date format option