Package java.net

Examples of java.net.Inet4Address


    );


    public static boolean isPrivateNetworkAddress(String inetAddress)
    {
        Inet4Address address = InetAddresses.getCoercedIPv4Address(InetAddresses.forString(inetAddress));
        return isPrivateNetworkAddress(address);
    }
View Full Code Here


        String[] parts = cidr.split("/");
        if (parts.length != 2) {
            throw new IllegalArgumentException("invalid CIDR format: " + cidr);
        }

        Inet4Address address = (Inet4Address) InetAddresses.forString(parts[0]);
        int bits = Integer.parseInt(parts[1]);

        return fromAddress(address, bits);
    }
View Full Code Here

    );


    public static boolean isPrivateNetworkAddress(String inetAddress)
    {
        Inet4Address address = InetAddresses.getCoercedIPv4Address(InetAddresses.forString(inetAddress));
        return isPrivateNetworkAddress(address);
    }
View Full Code Here

        assertAddressToLong("202.12.128.254", 3389817086L);
    }

    private static void assertAddressToLong(String address, long ip)
    {
        Inet4Address addr = (Inet4Address) InetAddresses.forString(address);
        assertEquals(Inet4Network.addressToLong(addr), ip);
    }
View Full Code Here

        assertFromAddress("208.86.202.0", "208.86.202.0/24", 24);
    }

    private static void assertFromAddress(String address, String cidr, int bits)
    {
        Inet4Address addr = (Inet4Address) InetAddresses.forString(address);
        assertEquals(Inet4Network.fromAddress(addr, bits), Inet4Network.fromCidr(cidr));
    }
View Full Code Here

        assertTruncatedFromAddress("208.86.202.0", "208.86.202.0/24", 24);
    }

    private static void assertTruncatedFromAddress(String address, String cidr, int bits)
    {
        Inet4Address addr = (Inet4Address) InetAddresses.forString(address);
        assertEquals(Inet4Network.truncatedFromAddress(addr, bits), Inet4Network.fromCidr(cidr));
    }
View Full Code Here

        assertFalse(containsAddress("202.12.128.0/18", "202.12.192.0"));
    }

    private static boolean containsAddress(String cidr, String address)
    {
        Inet4Address addr = (Inet4Address) InetAddresses.forString(address);
        return Inet4Network.fromCidr(cidr).containsAddress(addr);
    }
View Full Code Here

      throw new IllegalRawDataException(sb.toString());
    }

    this.timestampsWithAddresses = new ArrayList<TimestampWithAddress>();
    for (int i = 0; i < length; i += INT_SIZE_IN_BYTES * 2) {
      Inet4Address address = ByteArrays.getInet4Address(rawData, i + offset);
      Integer timestamp = null;
      if (i + INT_SIZE_IN_BYTES < length) {
        timestamp = ByteArrays.getInt(rawData, i + INT_SIZE_IN_BYTES + offset);
      }
      timestampsWithAddresses.add(new TimestampWithAddress(address, timestamp));
View Full Code Here

  public static void main(String[] args) throws PcapNativeException, NotOpenException {
    String strAddress = args[0];
    String strType = args[1]; // 3(DESTINATION_UNREACHABLE) or 11(TIME_EXCEEDED) or 12(PARAMETER_PROBLEM)
    String strCode = args[2];

    final Inet4Address address;
    try {
      address = (Inet4Address)InetAddress.getByName(strAddress);
    } catch (UnknownHostException e1) {
      throw new IllegalArgumentException("args[0]: " + strAddress);
    }
View Full Code Here

    String extension = "";
    if (pos > -1) {
      extension = file.substring(pos);
    }
    if (dialServer != null) {
      Inet4Address address = platform.getNetworAddress(dialServer.getIpAddress().getHostAddress());
      if (address != null) {
        String mediaUrl = null;
        if (isTranscoding) {
          // http://192.168.0.8:8087/cast.webm
          mediaUrl = "http://" + address.getHostAddress() + ":" + port + "/cast.webm";
        } else {
          startWebserver(null);

          mediaUrl = "http://" + address.getHostAddress() + ":" + port + "/video" + extension;
        }
        Log.d(LOG_TAG, "mediaUrl=" + mediaUrl);
        if (!rampClient.isClosed()) {
          rampClient.closeCurrentApp(dialServer);
        }
View Full Code Here

TOP

Related Classes of java.net.Inet4Address

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.