Class OptionUtils


  • public final class OptionUtils
    extends java.lang.Object
    Contains useful helper methods for classes within this package.
    • Constructor Summary

      Constructors 
      Constructor Description
      OptionUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String createPadding​(int len)
      Return a String of padding of length len.
      static int findWrapPos​(java.lang.String text, int width, int startPos)
      Finds the next text wrap position after startPos for the text in text with the column width width.
      static java.lang.String rtrim​(java.lang.String s)
      Remove the trailing whitespace from the specified String.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OptionUtils

        public OptionUtils()
    • Method Detail

      • createPadding

        public static java.lang.String createPadding​(int len)
        Return a String of padding of length len.
        Parameters:
        len - the length of the String of padding to create
        Returns:
        the String of padding
      • rtrim

        public static java.lang.String rtrim​(java.lang.String s)
        Remove the trailing whitespace from the specified String.
        Parameters:
        s - the String to remove the trailing padding from
        Returns:
        the String of without the trailing padding
      • findWrapPos

        public static int findWrapPos​(java.lang.String text,
                                      int width,
                                      int startPos)
        Finds the next text wrap position after startPos for the text in text with the column width width. The wrap point is the last position before startPos+width having a whitespace character (space, \n, \r). If there is no whitespace character before startPos+width, it will return startPos+width.
        Parameters:
        text - the text being searched for the wrap position
        width - width of the wrapped text
        startPos - position from which to start the lookup whitespace character
        Returns:
        position on which the text must be wrapped or -1 if the wrap position is at the end of the text