public abstract class AbstractQuantityFormat extends Format implements javax.measure.format.QuantityFormat, tech.uom.lib.common.function.Parser<CharSequence,javax.measure.Quantity>
This class provides the interface for formatting and parsing quantities.
Format.Field| Constructor and Description |
|---|
AbstractQuantityFormat() |
| Modifier and Type | Method and Description |
|---|---|
StringBuffer |
format(Object obj,
StringBuffer toAppendTo,
FieldPosition pos) |
String |
format(javax.measure.Quantity<?> quantity) |
abstract Appendable |
format(javax.measure.Quantity<?> quantity,
Appendable dest)
Formats the specified quantity into an
Appendable. |
protected StringBuffer |
format(javax.measure.Quantity<?> quantity,
StringBuffer dest)
Convenience method equivalent to
format(Quantity, Appendable) except it does not raise an IOException. |
abstract javax.measure.Quantity<?> |
parse(CharSequence csq)
Parses a portion of the specified
CharSequence from the specified position to produce an object. |
abstract javax.measure.Quantity<?> |
parse(CharSequence csq,
ParsePosition cursor)
Parses a portion of the specified
CharSequence from the specified position to produce an object. |
javax.measure.Quantity<?> |
parseObject(String source,
ParsePosition pos) |
clone, format, formatToCharacterIterator, parseObjectpublic AbstractQuantityFormat()
public abstract Appendable format(javax.measure.Quantity<?> quantity, Appendable dest) throws IOException
Appendable.format in interface javax.measure.format.QuantityFormatquantity - the quantity to format.dest - the appendable destination.Appendable.IOException - if an I/O exception occurs.public abstract javax.measure.Quantity<?> parse(CharSequence csq, ParsePosition cursor) throws IllegalArgumentException, javax.measure.format.MeasurementParseException
CharSequence from the specified position to produce an object. If parsing succeeds, then the index
of the cursor argument is updated to the index after the last character used.parse in interface javax.measure.format.QuantityFormatcsq - the CharSequence to parse.cursor - the cursor holding the current parsing index.IllegalArgumentException - if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).javax.measure.format.MeasurementParseExceptionpublic abstract javax.measure.Quantity<?> parse(CharSequence csq) throws javax.measure.format.MeasurementParseException
CharSequence from the specified position to produce an object. If parsing succeeds, then the index
of the cursor argument is updated to the index after the last character used.parse in interface javax.measure.format.QuantityFormatparse in interface tech.uom.lib.common.function.Parser<CharSequence,javax.measure.Quantity>csq - the CharSequence to parse.cursor - the cursor holding the current parsing index.IllegalArgumentException - if any problem occurs while parsing the specified character sequence (e.g. illegal syntax).javax.measure.format.MeasurementParseExceptionpublic final StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
public final javax.measure.Quantity<?> parseObject(String source, ParsePosition pos)
parseObject in class Formatprotected final StringBuffer format(javax.measure.Quantity<?> quantity, StringBuffer dest)
format(Quantity, Appendable) except it does not raise an IOException.quantity - the quantity to format.dest - the appendable destination.StringBuilder.Copyright © 2005–2024 Units of Measurement project. All rights reserved.