Class AdapterUtils

java.lang.Object
org.sejda.conversion.AdapterUtils

public final class AdapterUtils extends Object
Cli adapters parsing utils
Author:
Eduard Weissmann
  • Method Details

    • parseInt

      public static int parseInt(String input, String explainedInput)
      Parse input string into an integer, throwing an exception in case the input cannot be parsed
      Parameters:
      input -
      explainedInput - the user-friendly name of what the input represents, to be used in exception message. Ex: "page number" or "phone number"
      Returns:
      parsed int value
      Throws:
      SejdaRuntimeException - if the input cannot be parsed
      See Also:
    • split

      public static String[] split(String input)
      Splits an input string using the default ":" separator
      Parameters:
      input -
      Returns:
      an array of String tokens that result from the split
    • splitAndTrim

      public static String[] splitAndTrim(String input)
      Same as splitAndTrim(String, String) only it uses default ":" separator
      Parameters:
      input -
      Returns:
      an array of String tokens that result from the split
    • splitAndTrim

      public static String[] splitAndTrim(String input, String separator)
      Splits an input string using the specified separator. The input string is trimmed before being split, and the same trim operation is applied to all the split tokens
      Parameters:
      input -
      separator -
      Returns:
      an array of String tokens that result from the split
    • parseIntSilently

      public static Integer parseIntSilently(String input)
      Parse input string into an integer, silently returning a null in case the input cannot be parsed
      Parameters:
      input -
      Returns:
      an Integer matching the string input, or null if the input cannot be parsed as an Integer
      See Also:
    • isAllPages

      public static boolean isAllPages(String rawString)
      Parameters:
      rawString -
      Returns:
      true if the input raw string represent the sejda-console convention string for 'all', where 'all' is usually used when defining page selection to select all pages.