Class LineUtil


  • public abstract class LineUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      LineUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String reflowLine​(java.lang.String line)
      Reformats a line so that it fits in 78 characters max.
      static java.lang.String reformatLine​(java.lang.String format, java.lang.Object... params)
      Formats the string using String.format(String, Object...) and then returns the result of reflowLine(String).
      • Methods inherited from class java.lang.Object

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

      • LineUtil

        public LineUtil()
    • Method Detail

      • reflowLine

        public static java.lang.String reflowLine​(java.lang.String line)
        Reformats a line so that it fits in 78 characters max.

        When wrapping the second line and following, prefix the string with a number of spaces. This will use the first colon (:) to determine the prefix size or use 4 as a minimum if there are no colons in the string.

        Parameters:
        line - The line to reflow. Must be non-null.
        Returns:
        A new line to print as-is, that contains \n as needed.
      • reformatLine

        public static java.lang.String reformatLine​(java.lang.String format,
                                                    java.lang.Object... params)
        Formats the string using String.format(String, Object...) and then returns the result of reflowLine(String).
        Parameters:
        format - The string format.
        params - The parameters for the string format.
        Returns:
        The result of reflowLine(String) on the formatted string.