public interface QuantityFormat
Formats instances of Quantity
.
Instances of this class are not required to be thread-safe. It is recommended to use separate format instances for each thread. If multiple threads access a format concurrently, it must be synchronized externally.
Quantity
Modifier and Type | Method and Description |
---|---|
java.lang.Appendable |
format(Quantity<?> quantity,
java.lang.Appendable dest)
Formats the specified quantity into an
Appendable . |
default boolean |
isLocaleSensitive()
|
Quantity<?> |
parse(java.lang.CharSequence csq)
Parses a portion of the specified
CharSequence from the specified position to produce a Quantity . |
Quantity<?> |
parse(java.lang.CharSequence csq,
java.text.ParsePosition cursor)
Parses a portion of the specified
CharSequence from the specified position to produce a Quantity . |
java.lang.Appendable format(Quantity<?> quantity, java.lang.Appendable dest) throws java.io.IOException
Appendable
.quantity
- the quantity to format.dest
- the appendable destination.Appendable
.java.io.IOException
- if an I/O exception occurs.Quantity<?> parse(java.lang.CharSequence csq, java.text.ParsePosition cursor) throws java.lang.IllegalArgumentException, MeasurementParseException
CharSequence
from the specified position to produce a Quantity
. If parsing succeeds, then
the index of the cursor
argument is updated to the index after the last character used.csq
- the CharSequence
to parse.cursor
- the cursor holding the current parsing index.java.lang.IllegalArgumentException
- if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).MeasurementParseException
Quantity<?> parse(java.lang.CharSequence csq) throws MeasurementParseException
CharSequence
from the specified position to produce a Quantity
. If parsing succeeds, then
the index of the cursor
argument is updated to the index after the last character used.csq
- the CharSequence
to parse.cursor
- the cursor holding the current parsing index.java.lang.IllegalArgumentException
- if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).MeasurementParseException
default boolean isLocaleSensitive()
true
if this QuantityFormat
depends on a Locale
to perform its tasks.
In environments that do not support a Locale
, e.g. Java ME, this usually returns false
.
Copyright © 2014–2018 Jean-Marie Dautelle, Werner Keil, Otavio Santana. All rights reserved.