InternetProtocolFamily Type — netty Architecture
Architecture documentation for the InternetProtocolFamily type/interface in InternetProtocolFamily.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 160ac344_9fda_5e49_d572_860301563f7b["InternetProtocolFamily"] d3964699_dde9_171e_35ec_9b1be53855b2["InternetProtocolFamily.java"] 160ac344_9fda_5e49_d572_860301563f7b -->|defined in| d3964699_dde9_171e_35ec_9b1be53855b2 style 160ac344_9fda_5e49_d572_860301563f7b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/socket/InternetProtocolFamily.java lines 29–95
@Deprecated
public enum InternetProtocolFamily {
IPv4(Inet4Address.class, 1),
IPv6(Inet6Address.class, 2);
private final Class<? extends InetAddress> addressType;
private final int addressNumber;
InternetProtocolFamily(Class<? extends InetAddress> addressType, int addressNumber) {
this.addressType = addressType;
this.addressNumber = addressNumber;
}
/**
* Returns the address type of this protocol family.
*/
public Class<? extends InetAddress> addressType() {
return addressType;
}
/**
* Returns the
* <a href="https://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml">address number</a>
* of the family.
*/
public int addressNumber() {
return addressNumber;
}
/**
* Returns the {@link InetAddress} that represent the {@code LOCALHOST} for the family.
*/
public InetAddress localhost() {
switch (this) {
case IPv4:
return NetUtil.LOCALHOST4;
case IPv6:
return NetUtil.LOCALHOST6;
default:
throw new IllegalStateException("Unsupported family " + this);
}
}
/**
* Returns the {@link InternetProtocolFamily} for the given {@link InetAddress}.
*/
public static InternetProtocolFamily of(InetAddress address) {
if (address instanceof Inet4Address) {
return IPv4;
}
if (address instanceof Inet6Address) {
return IPv6;
}
throw new IllegalArgumentException("address " + address + " not supported");
}
public SocketProtocolFamily toSocketProtocolFamily() {
switch (this) {
case IPv4:
return SocketProtocolFamily.INET;
case IPv6:
return SocketProtocolFamily.INET6;
default:
throw new IllegalStateException();
}
}
}
Source
Frequently Asked Questions
What is the InternetProtocolFamily type?
InternetProtocolFamily is a type/interface in the netty codebase, defined in transport/src/main/java/io/netty/channel/socket/InternetProtocolFamily.java.
Where is InternetProtocolFamily defined?
InternetProtocolFamily is defined in transport/src/main/java/io/netty/channel/socket/InternetProtocolFamily.java at line 29.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free