com.darwinsys.util
Class StringFormat

java.lang.Object
  |
  +--java.text.Format
        |
        +--com.darwinsys.util.StringFormat

public class StringFormat
extends java.text.Format

Bare-minimum "String formatter": format a string to a given maximum length with left, centre, or right justification.

See Also:
Serialized Form

Field Summary
static int JUST_CENTER
           
static int JUST_CENTRE
           
static int JUST_LEFT
           
static int JUST_RIGHT
          Constant for right-justified Strings.
 
Constructor Summary
StringFormat(int maxChars, int just)
           
 
Method Summary
 java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer where, java.text.FieldPosition ignore)
          Format a String
protected  void pad(java.lang.StringBuffer to, int howMany)
           
 java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
          ParseObject is required by Format interface, but not useful here.
 
Methods inherited from class java.text.Format
clone, format, parseObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JUST_LEFT

public static final int JUST_LEFT

JUST_CENTRE

ublic static final int JUST_CENTRE

JUST_CENTER

public static final int JUST_CENTER

JUST_RIGHT

public static final int JUST_RIGHT
Constant for right-justified Strings.
Constructor Detail

StringFormat

public StringFormat(int maxChars,
                    int just)
Method Detail

format

public java.lang.StringBuffer format(java.lang.Object obj,
                                     java.lang.StringBuffer where,
                                     java.text.FieldPosition ignore)
Format a String
Overrides:
format in class java.text.Format

pad

protected final void pad(java.lang.StringBuffer to,
                         int howMany)

parseObject

public java.lang.Object parseObject(java.lang.String source,
                                    java.text.ParsePosition pos)
ParseObject is required by Format interface, but not useful here.
Overrides:
parseObject in class java.text.Format