Class TransportAddress
- java.lang.Object
-
- org.elasticsearch.common.transport.TransportAddress
-
- All Implemented Interfaces:
Writeable
,ToXContent
,ToXContentFragment
public final class TransportAddress extends java.lang.Object implements Writeable, ToXContentFragment
A transport address used for IP socket address (wrapsInetSocketAddress
).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
Fields Modifier and Type Field Description static java.net.InetAddress
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.-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description TransportAddress(java.net.InetAddress address, int port)
TransportAddress(java.net.InetSocketAddress address)
TransportAddress(StreamInput in)
Read from a stream.TransportAddress(StreamInput in, java.lang.String hostString)
Read from a stream and use thehostString
when creating the InetAddress if the input comes from a version on or priorVersion.V_5_0_2
as the hostString was not serialized
-
Method Summary
Modifier and Type Method Description java.net.InetSocketAddress
address()
Returns the enclosedInetSocketAddress
boolean
equals(java.lang.Object o)
java.lang.String
getAddress()
Returns a string representation of the enclosedInetSocketAddress
int
getPort()
Returns the addresses portint
hashCode()
java.lang.String
toString()
XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
META_ADDRESS
public static final java.net.InetAddress 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 Detail
-
TransportAddress
public TransportAddress(java.net.InetAddress address, int port)
-
TransportAddress
public TransportAddress(java.net.InetSocketAddress address)
-
TransportAddress
public TransportAddress(StreamInput in) throws java.io.IOException
Read from a stream.- Throws:
java.io.IOException
-
TransportAddress
public TransportAddress(StreamInput in, @Nullable java.lang.String hostString) throws java.io.IOException
Read from a stream and use thehostString
when creating the InetAddress if the input comes from a version on or priorVersion.V_5_0_2
as the hostString was not serialized- Throws:
java.io.IOException
-
-
Method Detail
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Writeable
Write this into the StreamOutput.
-
getAddress
public java.lang.String getAddress()
Returns a string representation of the enclosedInetSocketAddress
- See Also:
NetworkAddress.format(InetAddress)
-
getPort
public int getPort()
Returns the addresses port
-
address
public java.net.InetSocketAddress address()
Returns the enclosedInetSocketAddress
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
-