Parses a flat address string that has the syntax "/type1=name/type2=name/.../typeN=nameN".

@param addressStr flat address string
@return address
328849
public static Address parse(String addressStr) {
        Address address = root();

        if (addressStr == null) {
            return address;
        }

        addressStr = addressStr.trim();
        if (addressStr.isEmpty()) {
            return address;
        }

        String[] resources = addressStr.split("/");
        for (String resource : resources) {
            resource = resource.trim();
            if (resource.isEmpty()) {
                continue; // skip empty string - its usually due to first char in address being "/"
            }
            String[] typeAndName = resource.split("=");
            String type = typeAndName[0].trim();
            String name = (typeAndName.length == 2) ? typeAndName[1].trim() : "";
            address.add(type, name);
        }

        return address;
    }
1233515
private static String ipBytesToString(ByteBuf header, int addressLen) {
        StringBuilder sb = new StringBuilder();
        if (addressLen == 4) {
            sb.append(header.readByte() & 0xff);
            sb.append('.');
            sb.append(header.readByte() & 0xff);
            sb.append('.');
            sb.append(header.readByte() & 0xff);
            sb.append('.');
            sb.append(header.readByte() & 0xff);
        } else {
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
        }
        return sb.toString();
    }
43416
public static InetAddress InetAddressByIPv6(String address) {
    StringTokenizer addressTokens = new StringTokenizer(address, ":");
    byte[] bytes = new byte[16];
    if (addressTokens.countTokens() == 8) {
      int count = 0;
      while (addressTokens.hasMoreTokens()) {
        int word = Integer.parseInt(addressTokens.nextToken(), 16);
        bytes[count * 2]     = (byte) ((word >> 8) & 0xff);
        bytes[count * 2 + 1] = (byte) (word & 0xff);
        count++;
      }
    }
    else {
      return null;
    }
    try {
      return InetAddress.getByAddress(bytes);
    } catch (UnknownHostException e) {
      return null;
    }
  }
552287
public List<Address> getAddressesOfType(Type type) {
        List<Address> answer = new ArrayList<>(addresses.size());
        for (Address address : addresses) {
            if (address.getType().equals(type)) {
                answer.add(address);
            }
        }

        return answer;
    }
1261776
public static FormValidation validateInternetAddress(String address) {
        if (Strings.isNullOrEmpty(address)) {
            return FormValidation.ok();
        }
        Matcher matcher = VALID_EMAIL_PATTERN.matcher(address);
        if (matcher.matches()) {
            return FormValidation.ok();
        } else {
            return FormValidation.error("Email address is invalid");
        }
    }
89648
public static String formatAddress(int address) {
		int b1 = (address >>> 24) & 0xff;
		int b2 = (address >>> 16) & 0xff;
		int b3 = (address >>>  8) & 0xff;
		int b4 =  address         & 0xff;

		return "" + b1 + '.' + b2 + '.' + b3 + '.' + b4;
	}
365968
public static String toAddressString(InetSocketAddress address) {
        if (address == null) {
            return StringUtils.EMPTY;
        } else {
            return toIpString(address) + ":" + address.getPort();
        }
    }
1320154
def from_string(address):
		
		str_address = None

		if WMACAddress.re_dash_format.match(address):
			str_address = "".join(address.split("-"))
		elif WMACAddress.re_colon_format.match(address):
			str_address = "".join(address.split(":"))
		elif WMACAddress.re_cisco_format.match(address):
			str_address = "".join(address.split("."))
		elif WMACAddress.re_spaceless_format.match(address):
			str_address = address

		if str_address is None:
			raise ValueError("Invalid MAC address format: " + address)

		result = WMACAddress()
		for octet_index in range(WMACAddress.octet_count):
			octet = str_address[:2]
			result.__address[octet_index] = int(octet, 16)
			str_address = str_address[2:]

		return result
1321149
public String addAddressToTarget(String address)
    {
        if (address != null)
        {
            MessageDetailTarget messageDetailTarget = (MessageDetailTarget)this.getMainRecord();
            String site = messageDetailTarget.getProperty(TrxMessageHeader.DESTINATION_PARAM);
            site = this.getSiteFromAddress(address, site);
            if (!messageDetailTarget.setProperty(TrxMessageHeader.DESTINATION_PARAM, site))
                address = null; // This type doesn't take properties (never)
            messageDetailTarget.setProperty(TrxMessageHeader.DESTINATION_MESSAGE_PARAM, this.getPathFromAddress(address, site));
            String wsdlPath = messageDetailTarget.getProperty(TrxMessageHeader.WSDL_PATH);
            wsdlPath = this.getPathFromAddress(wsdlPath, site);
            if (wsdlPath != null)
                messageDetailTarget.setProperty(TrxMessageHeader.WSDL_PATH, wsdlPath);
        }
        return address;
    }
116091
public static InternetAddress[] parseAddressFromStrs(String[] addrStrs, Charset charset) {
		final List<InternetAddress> resultList = new ArrayList<>(addrStrs.length);
		InternetAddress[] addrs;
		for (int i = 0; i < addrStrs.length; i++) {
			addrs = parseAddress(addrStrs[i], charset);
			if(ArrayUtil.isNotEmpty(addrs)) {
				for(int j = 0 ; j < addrs.length; j++) {
					resultList.add(addrs[j]);
				}
			}
		}
		return resultList.toArray(new InternetAddress[resultList.size()]);
	}
1190215
protected RFC3881NetworkAccessPointTypeCodes getNetworkAccessPointCodeFromAddress(String address) {
        if (EventUtils.isEmptyOrNull(address)) {
            return null;
        }

        if (address.matches("^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$")) {
            return RFC3881NetworkAccessPointTypeCodes.IP_ADDRESS;
        }

        return RFC3881NetworkAccessPointTypeCodes.MACHINE_NAME;
    }
287571
def parse_address(address):
		

		if len(address) == 0:
			return None

		try:
			return WIPV4Address(address)
		except ValueError:
			pass

		try:
			return WFQDN(address)
		except ValueError:
			pass

		raise ValueError('Unable to parse address string. It must be an IP address or FQDN')
749816
private static byte[] parseDottedQuad(String address) {
		String[] splitString = address.split("\\.");

		if (splitString.length == 4) {

			int[] ints = new int[4];
			byte[] bytes = new byte[4];
			for (int i=0; i<4; i++) {
				ints[i] = Integer.parseInt(splitString[i]);
				if (ints[i] < 0 || ints[i] > 255) {
					throw new IllegalArgumentException("Invalid ip4Address or netmask");
				}
				bytes[i] = toByte(ints[i]); //a pox on java and it's signed bytes
			}

			return bytes;
		}
		else {
			throw new IllegalArgumentException("Address must be in dotted quad notation");
		}
	}
241139
public static String toIpString(InetSocketAddress address) {
        if (address == null) {
            return null;
        } else {
            InetAddress inetAddress = address.getAddress();
            return inetAddress == null ? address.getHostName() :
                inetAddress.getHostAddress();
        }
    }
733893
def parse_address(address: str) -> str:
    
    display_name, parsed_address = email.utils.parseaddr(address)

    return parsed_address or address
779798
private String parseHostAddress(String str)
	{
		String	header = "giop:tcp:";
		if (str.startsWith(header))
			str = str.substring(header.length());

		int		end = str.lastIndexOf(':');
		if (end>0)
			str = str.substring(0, end);
		return str;
	}
136462
public String getDisplayName (final String address, final String name) {
		return (name == null) ? address : (name + "<" + address + ">");
	}