Class LocalAddress

java.lang.Object
java.net.SocketAddress
io.netty.channel.local.LocalAddress
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<LocalAddress>

public final class LocalAddress extends java.net.SocketAddress implements java.lang.Comparable<LocalAddress>
An endpoint in the local transport. Each endpoint is identified by a unique case-insensitive string.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final LocalAddress
     
    private final java.lang.String
     
    private static final long
     
    private final java.lang.String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new ephemeral port based on the ID of the specified channel.
    LocalAddress(java.lang.Class<?> cls)
    Creates a new instance with a random ID based on the given class.
    LocalAddress(java.lang.String id)
    Creates a new instance with the specified ID.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    boolean
    equals(java.lang.Object o)
     
    int
     
    java.lang.String
    id()
    Returns the ID of this address.
    java.lang.String
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • ANY

      public static final LocalAddress ANY
    • id

      private final java.lang.String id
    • strVal

      private final java.lang.String strVal
  • Constructor Details

    • LocalAddress

      LocalAddress(Channel channel)
      Creates a new ephemeral port based on the ID of the specified channel. Note that we prepend an upper-case character so that it never conflicts with the addresses created by a user, which are always lower-cased on construction time.
    • LocalAddress

      public LocalAddress(java.lang.String id)
      Creates a new instance with the specified ID.
    • LocalAddress

      public LocalAddress(java.lang.Class<?> cls)
      Creates a new instance with a random ID based on the given class.
  • Method Details

    • id

      public java.lang.String id()
      Returns the ID of this address.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • compareTo

      public int compareTo(LocalAddress o)
      Specified by:
      compareTo in interface java.lang.Comparable<LocalAddress>
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object