com.darwinsys.lang
Class StringFormat

java.lang.Object
  extended by java.text.Format
      extended by com.darwinsys.lang.StringFormat
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

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

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.Format
java.text.Format.Field
 
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 maxCh, int justn)
           
 
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, formatToCharacterIterator, 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
See Also:
Constant Field Values

JUST_CENTRE

public static final int JUST_CENTRE
See Also:
Constant Field Values

JUST_CENTER

public static final int JUST_CENTER
See Also:
Constant Field Values

JUST_RIGHT

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

See Also:
Constant Field Values
Constructor Detail

StringFormat

public StringFormat(int maxCh,
                    int justn)
Method Detail

format

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

Specified by:
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.

Specified by:
parseObject in class java.text.Format


Copyright © 1996-2004 Ian F. Darwin. See license.html for usage license.