IP
- The supported type of IP address for built formatters.public static final class IPAddressFormatter.Builder<IP extends IPAddress<?>> extends Object
Modifier and Type | Method and Description |
---|---|
IPAddressFormatter<IP> |
build()
Returns a formatter for printing and parsing IP addresses with the current settings of this builder object.
|
IPAddressFormatter.Builder<IP> |
enclosingInBrackets()
Specifies that created formatters will enclose formatted IPv6 addresses in brackets.
|
IPAddressFormatter.Builder<IP> |
notEnclosingInBrackets()
Specifies that created formatters will not enclose formatted IPv6 addresses in brackets.
|
IPAddressFormatter.Builder<IP> |
toLowerCase()
Specifies that created formatters will format IPv6 addresses in lower case.
|
IPAddressFormatter.Builder<IP> |
toUpperCase()
Specifies that created formatters will format IPv6 addresses in upper case.
|
<R> R |
transform(Function<? super IPAddressFormatter.Builder<?>,? extends R> f)
This method allows the application of a function to this builder object.
|
IPAddressFormatter.Builder<IP> |
withDefaults()
Specifies that the default settings should be restored.
|
IPAddressFormatter.Builder<IP> |
withIPv4End()
Specifies that created formatters will format the last
4 bytes of IPv6 addresses as an IPv4 address. |
IPAddressFormatter.Builder<IP> |
withLongStyle()
Specifies that created formatters will format IPv6 addresses in long style.
|
IPAddressFormatter.Builder<IP> |
withMediumStyle()
Specifies that created formatters will format IPv6 addresses in medium style.
|
IPAddressFormatter.Builder<IP> |
withoutIPv4End()
Specifies that created formatters will format the last
4 bytes of IPv6 addresses as two hextets, not as an IPv4 address. |
IPAddressFormatter.Builder<IP> |
withShortStyle()
Specifies that created formatters will format IPv6 addresses in short style.
|
public IPAddressFormatter.Builder<IP> withShortStyle()
::1
will be formatted as ::1
, and 0:0:1:0:0:0:0:1
will be formatted as 0:0:1::1
.
This setting is ignored when formatting IPv4 addresses.
This is the default setting.
public IPAddressFormatter.Builder<IP> withMediumStyle()
::1
will be formatted as 0:0:0:0:0:0:0:1
.
This setting is ignored when formatting IPv4 addresses.public IPAddressFormatter.Builder<IP> withLongStyle()
::1
will be formatted as 0000:0000:0000:0000:0000:0000:0000:0001
.
This setting is ignored when formatting IPv4 addresses.public IPAddressFormatter.Builder<IP> toUpperCase()
public IPAddressFormatter.Builder<IP> toLowerCase()
This is the default setting.
public IPAddressFormatter.Builder<IP> withIPv4End()
4
bytes of IPv6 addresses as an IPv4 address.
For example, ::1
will be formatted as ::0.0.0.1
, 0:0:0:0:0:0:0.0.0.1
or
0000:0000:0000:0000:0000:0000:0.0.0.1
, depending on the style.
This setting is ignored when formatting IPv4 addresses.public IPAddressFormatter.Builder<IP> withoutIPv4End()
4
bytes of IPv6 addresses as two hextets, not as an IPv4 address.
This setting is ignored when formatting IPv4 addresses.
This is the default setting.
public IPAddressFormatter.Builder<IP> enclosingInBrackets()
::1
will be formatted as [::1]
, [0:0:0:0:0:0:0:1]
or
[0000:0000:0000:0000:0000:0000:0000:0001]
, depending on the style.
This setting is ignored when formatting IPv4 addresses.public IPAddressFormatter.Builder<IP> notEnclosingInBrackets()
This is the default setting.
public IPAddressFormatter.Builder<IP> withDefaults()
withShortStyle()
,
toLowerCase()
, withoutIPv4End()
and notEnclosingInBrackets()
.public <R> R transform(Function<? super IPAddressFormatter.Builder<?>,? extends R> f)
Any exception thrown by the function will be propagated to the caller.
R
- The type of the result of the function.f
- The function to apply.public IPAddressFormatter<IP> build()
Copyright © 2019–2023. All rights reserved.