Java Code Examples for java.net.InetAddress#getAllByName0()

The following examples show how to use java.net.InetAddress#getAllByName0() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 2
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 3
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 4
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 5
Source Project: JDKSourceCode1.8   File: SocketPermission.java    License: MIT License 5 votes vote down vote up
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 6
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 7
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 8
Source Project: Bytecoder   File: SocketPermission.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(':');
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 9
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(':');
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 10
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 11
Source Project: Java8CN   File: SocketPermission.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 12
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 13
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 14
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 15
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 16
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 17
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}
 
Example 18
/**
 * get IP addresses. Sets invalid to true if we can't get them.
 *
 */
void getIP()
    throws UnknownHostException
{
    if (addresses != null || wildcard || invalid) return;

    try {
        // now get all the IP addresses
        String host;
        if (getName().charAt(0) == '[') {
            // Literal IPv6 address
            host = getName().substring(1, getName().indexOf(']'));
        } else {
            int i = getName().indexOf(":");
            if (i == -1)
                host = getName();
            else {
                host = getName().substring(0,i);
            }
        }

        addresses =
            new InetAddress[] {InetAddress.getAllByName0(host, false)[0]};

    } catch (UnknownHostException uhe) {
        invalid = true;
        throw uhe;
    }  catch (IndexOutOfBoundsException iobe) {
        invalid = true;
        throw new UnknownHostException(getName());
    }
}