RegisterSign In

API Documentation: Class ServiceAddress

Package: com.mckoi.network
implements java.lang.Comparable

An address/port of a service in an IP based network, represented as an 128-bit field. The format of the address follows ipv6 conventions.

Constructors Summary

ServiceAddress(byte[] net_address, int port)
ServiceAddress(java.net.InetAddress inet_address, int port)

Methods Summary

byte[] getAddress()
int getPort()
java.net.InetAddress asInetAddress()
static ServiceAddress readFrom(DataInput in) throws IOException
void writeTo(DataOutput out) throws IOException
static ServiceAddress parseString(String str) throws IOException
String formatString()
String displayString()
String toString()
int hashCode()
boolean equals(Object ob)
int compareTo(Object ob)

Constructor Details

ServiceAddress(byte[] net_address, int port)

Constructs the address as a 16 byte ipv6 address and port value.

ServiceAddress(java.net.InetAddress inet_address, int port)

Constructs the address from an InetAddress and port value.

Method Details

byte[] getAddress()

Returns the network address as a 16 byte ipv6 network address. If the address is a 4 byte ipv4 address, it is encoded as an 16 byte ipv6 address over a ipv4 network.

int getPort()

Returns the port of the service.

java.net.InetAddress asInetAddress()

Returns the address as an InetAddress. This will return either an ipv4 or ipv6 InetAddress depending on the format of the network address.

static ServiceAddress readFrom(DataInput in)

Reads a ServiceAddress encoded in a data input stream.

void writeTo(DataOutput out)

Encodes this ServiceAddress to a data output stream.

static ServiceAddress parseString(String str)

Parses a service address generated from 'formatString'.

String formatString()

Formats this ServiceAddress as a string that can be parsed by 'parseString'.

String displayString()

Returns this ServiceAddress as a string suitable for display to a user.

String toString()

int hashCode()

boolean equals(Object ob)

int compareTo(Object ob)

The text on this page is licensed under the Creative Commons Attribution 3.0 License. Java is a registered trademark of Oracle and/or its affiliates.
Mckoi is Copyright © 2000 - 2020 Diehl and Associates, Inc. All rights reserved.