Java Socket Address Get parseAddress(SocketAddress address)

Here you can find the source of parseAddress(SocketAddress address)

Description

parse Address

License

Apache License

Declaration

public static String[] parseAddress(SocketAddress address) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.net.SocketAddress;

public class Main {
    public static String[] parseAddress(SocketAddress address) {
        String addressStr = address.toString();
        if (addressStr.startsWith("/")) {
            addressStr = addressStr.replace("/", "");
        }/*from ww w.jav a  2 s .  c o  m*/
        String[] tmp = addressStr.split(":");
        return tmp;
    }

    public static String toString(Object... args) {
        StringBuilder s = new StringBuilder();
        for (Object arg : args) {
            if (arg != null) {
                s.append(arg);
            }
        }
        return s.toString();
    }
}

Related

  1. isSameAddress(SocketAddress a1, SocketAddress a2)
  2. isUdpPortAvailable(InetSocketAddress localAddress)
  3. isUnresolved(SocketAddress address)
  4. isValidMulticastAddress(final InetSocketAddress address)
  5. normalizeSocketAddr(InetSocketAddress address)
  6. parseInetSocketAddress(String address)
  7. parseInetSocketAddress(String endPoint)
  8. parseInetSocketAddress(String text)
  9. parseSocketAddress(String address)