Here you can find the source of parseInetSocketAddress(String address)
Parameter | Description |
---|---|
address | socket address to parse |
Parameter | Description |
---|---|
IOException | if the socket address is invalid |
public static InetSocketAddress parseInetSocketAddress(String address) throws IOException
//package com.java2s; /*/* w ww. ja v a2s . c o m*/ * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0 * (the ?License??). You may not use this work except in compliance with the License, which is * available at www.apache.org/licenses/LICENSE-2.0 * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied, as more fully set forth in the License. * * See the NOTICE file distributed with this work for information regarding copyright ownership. */ import java.io.IOException; import java.net.InetSocketAddress; public class Main { /** * Parses {@link InetSocketAddress} from a String. * * @param address socket address to parse * @return InetSocketAddress of the String * @throws IOException if the socket address is invalid */ public static InetSocketAddress parseInetSocketAddress(String address) throws IOException { if (address == null) { return null; } String[] strArr = address.split(":"); if (strArr.length != 2) { throw new IOException("Invalid InetSocketAddress " + address); } return new InetSocketAddress(strArr[0], Integer.parseInt(strArr[1])); } }