src/java.base/share/classes/java/nio/channels/UnixDomainSocketAddress.java
branchunixdomainchannels
changeset 59077 85df93a18fe0
parent 58847 692de65ab293
equal deleted inserted replaced
59076:998df1368cca 59077:85df93a18fe0
    30 import java.security.AccessController;
    30 import java.security.AccessController;
    31 import java.security.PrivilegedAction;
    31 import java.security.PrivilegedAction;
    32 import java.util.Objects;
    32 import java.util.Objects;
    33 
    33 
    34 /**
    34 /**
    35  * An address for a Unix domain socket or server socket channel. These
    35  * An address for a Unix domain {@link SocketChannel} or {@link ServerSocketChannel}.
    36  * addresses contain a String path name, which when bound to a channel,
    36  * These addresses contain a String path name, which when bound to a channel,
    37  * have an associated file in the file-system with the same name.
    37  * have an associated file in the file-system with the same name.
    38  * <p>
    38  * <p>
    39  * If a channel is automatically bound to a Unix domain address then its address
    39  * If a channel is automatically bound to a Unix domain address then its address
    40  * is unnamed; it has an empty path field, and therefore has no associated
    40  * is unnamed; it has an empty path field, and therefore has no associated
    41  * file in the file-system.
    41  * file in the file-system. {@link SocketChannel}s can be automatically bound
    42  * <p>
    42  * in this way, but {@link ServerSocketChannel}s cannot and must be bound to
    43  * Note, not all channel types support Unix domain addresses.
    43  * an explicit address.
    44  *
    44  *
    45  * @since 14
    45  * @since 14
    46  */
    46  */
    47 public class UnixDomainSocketAddress extends SocketAddress {
    47 public class UnixDomainSocketAddress extends SocketAddress {
    48 
    48 
   116             return false;
   116             return false;
   117         UnixDomainSocketAddress that = (UnixDomainSocketAddress)o;
   117         UnixDomainSocketAddress that = (UnixDomainSocketAddress)o;
   118         return this.path.equals(that.path);
   118         return this.path.equals(that.path);
   119     }
   119     }
   120 
   120 
       
   121     /**
       
   122      * Returns a string representation of this {@code UnixDomainSocketAddress}.
       
   123      * The format of the string is {@code "af_unix:<path>"} where {@code <path>}
       
   124      * is this address's path field, which will be empty in the case of an
       
   125      * unnamed socket address.
       
   126      */
   121     @Override
   127     @Override
   122     public String toString() {
   128     public String toString() {
   123         StringBuilder sb = new StringBuilder();
   129         StringBuilder sb = new StringBuilder();
   124         sb.append("af_unix:");
   130         sb.append("af_unix:");
   125         if (path != null)
   131         if (path != null)