Class UnixDomainSocketAddress

java.lang.Object
java.net.SocketAddress
java.net.UnixDomainSocketAddress
All Implemented Interfaces:
Serializable

public final class UnixDomainSocketAddress extends SocketAddress
A Unix domain socket address. A Unix domain socket address encapsulates a file-system path that Unix domain sockets bind or connect to.

An unnamed UnixDomainSocketAddress has an empty path. The local address of a SocketChannel to a Unix domain socket that is automatically or implicitly bound will be unnamed.

Path objects used to create instances of this class must be obtained from the system-default file system.

Since:
16
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares this address with another object.
    Returns this address's path.
    int
    Returns the hash code of this UnixDomainSocketAddress
    of(String pathname)
    Creates a UnixDomainSocketAddress from the given path string.
    of(Path path)
    Creates a UnixDomainSocketAddress for the given path.
    Returns a string representation of this UnixDomainSocketAddress.

    Methods declared in class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Method Details

    • of

      public static UnixDomainSocketAddress of(String pathname)
      Creates a UnixDomainSocketAddress from the given path string.
      Parameters:
      pathname - The path string, which can be empty
      Returns:
      A UnixDomainSocketAddress
      Throws:
      InvalidPathException - If the path cannot be converted to a Path
      NullPointerException - if pathname is null
    • of

      public static UnixDomainSocketAddress of(Path path)
      Creates a UnixDomainSocketAddress for the given path.
      Parameters:
      path - The path to the socket, which can be empty
      Returns:
      A UnixDomainSocketAddress
      Throws:
      IllegalArgumentException - If the path is not associated with the default file system
      NullPointerException - if path is null
    • getPath

      public Path getPath()
      Returns this address's path.
      Returns:
      this address's path
    • hashCode

      public int hashCode()
      Returns the hash code of this UnixDomainSocketAddress
      Overrides:
      hashCode in class Object
      Returns:
      the receiver's hash.
      See Also:
    • equals

      public boolean equals(Object o)
      Compares this address with another object.
      Overrides:
      equals in class Object
      Parameters:
      o - Object the object to compare with this object.
      Returns:
      true if the path fields are equal
      See Also:
    • toString

      public String toString()
      Returns a string representation of this UnixDomainSocketAddress.
      Overrides:
      toString in class Object
      Returns:
      this address's path which may be empty for an unnamed address