Class Formatter


  • public class Formatter
    extends java.lang.Object
    Various useful formatting methods for working with html
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String _rcsid  
    • Constructor Summary

      Constructors 
      Constructor Description
      Formatter()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String[] formatString​(java.lang.String value, int maxWidth, boolean multiple, boolean ellipsis)
      Format a string as a number of continuation fields, so that the total string is not too long.
      static java.lang.String formatTime​(java.util.TimeZone tz, java.util.Locale locale, long time)
      Format a long as an understandable date.
      protected static void writechars​(java.lang.StringBuilder sb, int value, int length)  
      • Methods inherited from class java.lang.Object

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

      • Formatter

        public Formatter()
    • Method Detail

      • formatTime

        public static java.lang.String formatTime​(java.util.TimeZone tz,
                                                  java.util.Locale locale,
                                                  long time)
        Format a long as an understandable date.
        Parameters:
        time - is the long.
        Returns:
        the date, as a human-readable string.
      • formatString

        public static java.lang.String[] formatString​(java.lang.String value,
                                                      int maxWidth,
                                                      boolean multiple,
                                                      boolean ellipsis)
        Format a string as a number of continuation fields, so that the total string is not too long.
        Parameters:
        value - is the string to format.
        maxWidth - is the maximum width desired for each field.
        multiple - is true if multiple lines desired.
        ellipsis - is true if ellipses are desired for each non-terminal line.
        Returns:
        an array of strings representing the split-up value.
      • writechars

        protected static void writechars​(java.lang.StringBuilder sb,
                                         int value,
                                         int length)