Java Socket Address Get toString(InetSocketAddress socketAddress)

Here you can find the source of toString(InetSocketAddress socketAddress)

Description

Returns <host>:<port>

License

Open Source License

Declaration

public static String toString(InetSocketAddress socketAddress) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.net.InetSocketAddress;

public class Main {
    private static final String TO_STRING_FORMAT = "%s:%s";

    /**/*from   w w w  .  ja  v a 2 s.co  m*/
     * Returns &lt;host&gt;:&lt;port&gt;
     */
    public static String toString(InetSocketAddress socketAddress) {
        return String.format(TO_STRING_FORMAT, socketAddress.getAddress().getHostAddress(),
                socketAddress.getPort());
    }
}

Related

  1. toInetSocketAddressLIst(List addressList)
  2. toInetSocketAddressList(String addresses, int defaultPort)
  3. toSocketAddress(URL url)
  4. toString(InetSocketAddress addr)
  5. toString(InetSocketAddress entryServer)
  6. writeAddress(DataOutputStream outputStream, InetSocketAddress address, int version)
  7. writeAddress(InetSocketAddress address, DataOutput out)