Unit to a String or Appendable and parses a CharSequence to a Unit.
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.
Unit
| Modifier and Type | Method and Description |
|---|---|
| public Appendable | Returns: the appendable destination passed in with formatted text appended.the unit, Appendable Unit to format, not nullthe appendable destination. appendable)Formats the specified |
| public String | Returns: the string representation using the settings of thisUnitFormat.the unit)Unit to format, not nullFormats the specified |
| public default boolean | Returns: Whether this format depends on a locale.Returns |
| public void | |
| public Unit | Returns: the unit parsed from the specified character sub-sequence.the csq, ParsePosition CharSequence to parse.a ParsePosition object holding the current parsing index and error parsing index information as described above. pos)Parses a portion of the specified |
| public Unit | Returns: the unit parsed from the specified character sequence.the csq)CharSequence to parse.Parses the text into an instance of |
| format | back to summary |
|---|---|
| public Appendable format(Unit<?> unit, Appendable appendable) throws IOException Formats the specified
| |
| format | back to summary |
|---|---|
| public String format(Unit<?> unit) Formats the specified
| |
| isLocaleSensitive | back to summary |
|---|---|
| public default boolean isLocaleSensitive() Returns
In environments that do not support a
| |
| label | back to summary |
|---|---|
| public void label(Unit<?> unit, String label) Attaches a system-wide label to the specified
This method overrides the previous unit's label (e.g. label from unit database or unit system) as units may only have one label. Depending on the
UnitFormat implementation is explicitly immutable, similar to e.g. the result of Collections.unmodifiableList(),
then an UnsupportedOperationException may be thrown upon this call.
Since
| |
| parse | back to summary |
|---|---|
| public Unit Parses a portion of the specified
| |
| parse | back to summary |
|---|---|
| public Unit Parses the text into an instance of The parse must complete normally and parse the entire text. If the parse completes without reading the entire length of the text, an exception is thrown. If any other problem occurs during parsing, an exception is thrown.
| |