IP - The supported type of IP address.public abstract class IPAddressFormat<IP extends IPAddress<?>> extends Format
asFormat method of an IPAddressFormatter are immutable.Format.Field| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Deprecated.
IPAddressFormat instances are immutable, and should not be cloned. |
boolean |
equals(Object o) |
StringBuffer |
format(Object obj,
StringBuffer toAppendTo,
FieldPosition pos)
Formats an IP address and appends the resulting text to the given
StringBuffer. |
int |
hashCode() |
IP |
parse(CharSequence source)
Parses a
CharSequence to an IP address. |
IP |
parse(CharSequence source,
ParsePosition position)
Attempts to parse a
CharSequence to an IP address. |
IP |
parseObject(String source) |
IP |
parseObject(String source,
ParsePosition position) |
format, formatToCharacterIteratorpublic StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
StringBuffer.
This method supports IPAddresses of the correct type, and byte arrays of the correct size.
For instance, an IPAddressFormat for IPv4Address only supports IPv4Address and arrays of 4 bytes,
and an IPAddressFormat for IPv6Address only supports IPv6Address and arrays of 16 bytes,format in class Formatobj - The object to format.toAppendTo - The StringBuffer to append to.pos - A FieldPosition identifying a field in the formatted text; ignored.StringBuffer.NullPointerException - If the given StringBuffer is null.IllegalArgumentException - If the given object is not an IPAddress of the correct type or byte array of the correct size.public IP parseObject(String source, ParsePosition position)
parseObject in class Formatpublic IP parseObject(String source) throws ParseException
parseObject in class FormatParseExceptionpublic IP parse(CharSequence source, ParsePosition position)
CharSequence to an IP address. Parsing starts at the current index of the given ParsePosition.
If parsing succeeds, the given ParsePosition's index is updated to the
index after the last character that was used for parsing. The updated position can be used as a starting point for other parsing.
If parsing fails, the given ParsePosition's index is not modified, but its error index is set to the index of the character that
caused parsing to fail.
source - The CharSequence to parse.position - The ParsePosition to update as described.null if parsing fails.NullPointerException - If the given CharSequence or ParsePosition is null.public IP parse(CharSequence source) throws ParseException
CharSequence to an IP address. This method is like parseObject(String), but unlike that method this method will use
the entire CharSequence.source - The CharSequence to parse.NullPointerException - If the given CharSequence is null.ParseException - If the CharSequence could not be parsed to an IP address.@Deprecated public Object clone()
IPAddressFormat instances are immutable, and should not be cloned.Copyright © 2019–2023. All rights reserved.