gnu.text

Class PadFormat


public class PadFormat
extends ReportFormat

Given a Format, pad the formatted result to a specified width.

Field Summary

Fields inherited from class gnu.text.ReportFormat

PARAM_FROM_COUNT, PARAM_FROM_LIST, PARAM_UNSPECIFIED

Constructor Summary

PadFormat(Format fmt, int minWidth)
PadFormat(Format fmt, int minWidth, char padChar, int where)

Method Summary

static int
format(Format fmt, Object[] args, int start, Writer dst, char padChar, int minWidth, int colInc, int minPad, int where, FieldPosition fpos)
int
format(Object[] args, int start, Writer dst, FieldPosition fpos)
Format an array of arguments, and write out the result.
static int
padNeeded(int actualWidth, int minWidth, int colInc, int minPad)

Methods inherited from class gnu.text.ReportFormat

format, format, format, format, format, format, getParam, getParam, getParam, nextArg, parseObject, print, result, resultCode

Constructor Details

PadFormat

public PadFormat(Format fmt,
                 int minWidth)

PadFormat

public PadFormat(Format fmt,
                 int minWidth,
                 char padChar,
                 int where)

Method Details

format

public static int format(Format fmt,
                         Object[] args,
                         int start,
                         Writer dst,
                         char padChar,
                         int minWidth,
                         int colInc,
                         int minPad,
                         int where,
                         FieldPosition fpos)
            throws java.io.IOException

format

public int format(Object[] args,
                  int start,
                  Writer dst,
                  FieldPosition fpos)
            throws java.io.IOException
Format an array of arguments, and write out the result.
Overrides:
format in interface ReportFormat
Parameters:
args - the objects to be formatted
start - the index (in args) of the argument to start with
dst - where to write the result
Returns:
an integer result(resultCode, nextArg), where nextArg is the index following the last argument processed, and code is a result code (normally 0, or negative if early termintation)

padNeeded

public static int padNeeded(int actualWidth,
                            int minWidth,
                            int colInc,
                            int minPad)