Java Socket Address Get stringAddressToSocketAddress(String address)

Here you can find the source of stringAddressToSocketAddress(String address)

Description

string Address To Socket Address

License

Apache License

Declaration

public static SocketAddress stringAddressToSocketAddress(String address) 

Method Source Code


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

import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Objects;

public class Main {
    public static SocketAddress stringAddressToSocketAddress(String address) {
        Objects.requireNonNull(address);

        String[] strings = address.split(":");

        return new InetSocketAddress(strings[0], Integer.valueOf(strings[1]));
    }/*from  ww w . j a  v a2s.c o  m*/
}

Related

  1. parseSocketAddress(String socketAddress)
  2. parseSocketAddressAddr(SocketAddress socketAddress)
  3. sizeOfInet(InetSocketAddress inet)
  4. socketAddress2String(final SocketAddress addr)
  5. string2SocketAddress(final String addr)
  6. stringifyInetSocketAddressList(InetSocketAddress[] addresses)
  7. stringToInetSocketAddress( String address, int defaultPort)
  8. toAddressString(InetSocketAddress address)
  9. toByte(InetSocketAddress socketAddress)