public abstract class CompositeFormat
extends java.text.Format
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
Serializable version identifier.
|
Constructor and Description |
---|
CompositeFormat() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.StringBuffer |
formatDouble(double value,
java.text.NumberFormat format,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Formats a double value to produce a string.
|
protected static java.text.NumberFormat |
getDefaultNumberFormat()
Create a default number format.
|
protected static java.text.NumberFormat |
getDefaultNumberFormat(java.util.Locale locale)
Create a default number format.
|
protected void |
parseAndIgnoreWhitespace(java.lang.String source,
java.text.ParsePosition pos)
Parses
source until a non-whitespace character is found. |
protected boolean |
parseFixedstring(java.lang.String source,
java.lang.String expected,
java.text.ParsePosition pos)
Parse
source for an expected fixed string. |
protected char |
parseNextCharacter(java.lang.String source,
java.text.ParsePosition pos)
Parses
source until a non-whitespace character is found. |
private java.lang.Number |
parseNumber(java.lang.String source,
double value,
java.text.ParsePosition pos)
Parses
source for special double values. |
protected java.lang.Number |
parseNumber(java.lang.String source,
java.text.NumberFormat format,
java.text.ParsePosition pos)
Parses
source for a number. |
private static final long serialVersionUID
protected static java.text.NumberFormat getDefaultNumberFormat()
NumberFormat.getInstance()
with the only customizing that the
maximum number of fraction digits is set to 2.protected static java.text.NumberFormat getDefaultNumberFormat(java.util.Locale locale)
NumberFormat.getInstance(java.util.Locale)
with the only
customizing that the maximum number of fraction digits is set to 2.locale
- the specific locale used by the format.protected void parseAndIgnoreWhitespace(java.lang.String source, java.text.ParsePosition pos)
source
until a non-whitespace character is found.source
- the string to parsepos
- input/ouput parsing parameter. On output, pos
holds the index of the next non-whitespace character.protected char parseNextCharacter(java.lang.String source, java.text.ParsePosition pos)
source
until a non-whitespace character is found.source
- the string to parsepos
- input/ouput parsing parameter.private java.lang.Number parseNumber(java.lang.String source, double value, java.text.ParsePosition pos)
source
for special double values. These values
include Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY.source
- the string to parsevalue
- the special value to parse.pos
- input/ouput parsing parameter.protected java.lang.Number parseNumber(java.lang.String source, java.text.NumberFormat format, java.text.ParsePosition pos)
source
for a number. This method can parse normal,
numeric values as well as special values. These special values include
Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY.source
- the string to parseformat
- the number format used to parse normal, numeric values.pos
- input/ouput parsing parameter.protected boolean parseFixedstring(java.lang.String source, java.lang.String expected, java.text.ParsePosition pos)
source
for an expected fixed string.source
- the string to parseexpected
- expected stringpos
- input/ouput parsing parameter.protected java.lang.StringBuffer formatDouble(double value, java.text.NumberFormat format, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
. There are
three exceptions to this:
value
- the double to format.format
- the format used.toAppendTo
- where the text is to be appendedpos
- On input: an alignment field, if desired. On output: the
offsets of the alignment fieldCopyright (c) 2003-2013 Apache Software Foundation