Java Code Examples for java.net.Inet6Address.getScopedInterface()

The following are Jave code examples for showing how to use getScopedInterface() of the java.net.Inet6Address class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: jdk8u-jdk   File: Inet6AddressSerializationTest.java   Source Code and License Vote up 6 votes
static void displayExpectedInet6Address(Inet6Address expectedInet6Address) {

        String expectedHostName = expectedInet6Address.getHostName();
        byte[] expectedAddress = expectedInet6Address.getAddress();
        String expectedHostAddress = expectedInet6Address.getHostAddress();
        int expectedScopeId = expectedInet6Address.getScopeId();
        NetworkInterface expectedNetIf = expectedInet6Address
                .getScopedInterface();

        System.err.println("Excpected HostName: " + expectedHostName);
        System.err.println("Expected Address: "
                + Arrays.toString(expectedAddress));
        System.err.println("Expected HostAddress: " + expectedHostAddress);
        System.err.println("Expected Scope Id " + expectedScopeId);
        System.err.println("Expected NetworkInterface " + expectedNetIf);
        System.err.println("Expected Inet6Address " + expectedInet6Address);
    }
 
Example 2
Project: openjdk-jdk10   File: Inet6AddressSerializationTest.java   Source Code and License Vote up 6 votes
static void displayExpectedInet6Address(Inet6Address expectedInet6Address) {

        String expectedHostName = expectedInet6Address.getHostName();
        byte[] expectedAddress = expectedInet6Address.getAddress();
        String expectedHostAddress = expectedInet6Address.getHostAddress();
        int expectedScopeId = expectedInet6Address.getScopeId();
        NetworkInterface expectedNetIf = expectedInet6Address
                .getScopedInterface();

        System.err.println("Excpected HostName: " + expectedHostName);
        System.err.println("Expected Address: "
                + Arrays.toString(expectedAddress));
        System.err.println("Expected HostAddress: " + expectedHostAddress);
        System.err.println("Expected Scope Id " + expectedScopeId);
        System.err.println("Expected NetworkInterface " + expectedNetIf);
        System.err.println("Expected Inet6Address " + expectedInet6Address);
    }
 
Example 3
Project: jdk8u-jdk   File: Inet6AddressSerializationTest.java   Source Code and License Vote up 5 votes
private static String getIfName(Inet6Address inet6Addr) {
    String ifname;
    if (inet6Addr.getScopedInterface() != null) {
        ifname = "_ifname_" + inet6Addr.getScopedInterface().getName();
    } else {
        ifname = "_ifname_"
                + Integer.valueOf(inet6Addr.getScopeId()).toString();
    }
    return ifname;
}
 
Example 4
Project: jdk8u-jdk   File: Inet6AddressSerializationTest.java   Source Code and License Vote up 5 votes
private static String createOutputFileName(Inet6Address inet6Addr) {
    String inet6AddressOutputFilename;
    if (inet6Addr.getScopedInterface() != null) {
        inet6AddressOutputFilename = "IPV6Address_"
                + inet6Addr.getScopedInterface().getName() + ".out";
    } else {
        inet6AddressOutputFilename = "IPV6Address_"
                + Integer.valueOf(inet6Addr.getScopeId()).toString()
                + ".out";
    }
    return inet6AddressOutputFilename;
}
 
Example 5
Project: openjdk-jdk10   File: Inet6AddressSerializationTest.java   Source Code and License Vote up 5 votes
private static String getIfName(Inet6Address inet6Addr) {
    String ifname;
    if (inet6Addr.getScopedInterface() != null) {
        ifname = "_ifname_" + inet6Addr.getScopedInterface().getName();
    } else {
        ifname = "_ifname_"
                + Integer.valueOf(inet6Addr.getScopeId()).toString();
    }
    return ifname;
}
 
Example 6
Project: openjdk-jdk10   File: Inet6AddressSerializationTest.java   Source Code and License Vote up 5 votes
private static String createOutputFileName(Inet6Address inet6Addr) {
    String inet6AddressOutputFilename;
    if (inet6Addr.getScopedInterface() != null) {
        inet6AddressOutputFilename = "IPV6Address_"
                + inet6Addr.getScopedInterface().getName() + ".out";
    } else {
        inet6AddressOutputFilename = "IPV6Address_"
                + Integer.valueOf(inet6Addr.getScopeId()).toString()
                + ".out";
    }
    return inet6AddressOutputFilename;
}