Class TransportAddress
java.lang.Object
org.opensearch.core.common.transport.TransportAddress
- All Implemented Interfaces:
Writeable,ToXContent,ToXContentFragment
@PublicApi(since="1.0.0")
public final class TransportAddress
extends Object
implements Writeable, ToXContentFragment
A transport address used for IP socket address (wraps
InetSocketAddress).- Opensearch.api:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.WriteableRegistry, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final InetAddressA non-routeable v4 meta transport address that can be used for testing or in scenarios where targets should be marked as non-applicable from a transport perspective.Fields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionTransportAddress(InetAddress address, int port) TransportAddress(InetSocketAddress address) Creates a newTransportAddressfrom aInetSocketAddress.Creates a newTransportAddressfrom aStreamInput. -
Method Summary
Modifier and TypeMethodDescriptionaddress()Returns the enclosedInetSocketAddressbooleanReturns a string representation of the enclosedInetSocketAddressintgetPort()Returns the addresses portinthashCode()toString()toXContent(XContentBuilder builder, ToXContent.Params params) voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opensearch.core.xcontent.ToXContentFragment
isFragment
-
Field Details
-
META_ADDRESS
A non-routeable v4 meta transport address that can be used for testing or in scenarios where targets should be marked as non-applicable from a transport perspective.
-
-
Constructor Details
-
TransportAddress
-
TransportAddress
Creates a newTransportAddressfrom aInetSocketAddress.- Parameters:
address- the address to wrap- Throws:
IllegalArgumentException- if the address is null or not resolved- See Also:
-
TransportAddress
Creates a newTransportAddressfrom aStreamInput.- Parameters:
in- the stream to read from- Throws:
IOException- if an I/O error occurs
-
-
Method Details
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getAddress
Returns a string representation of the enclosedInetSocketAddress- See Also:
-
getPort
public int getPort()Returns the addresses port- Returns:
- the port number, or 0 if the socket is not bound yet.
- See Also:
-
address
Returns the enclosedInetSocketAddress -
equals
-
hashCode
public int hashCode() -
toString
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-