congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Subnet.toInt
Code IndexAdd Tabnine to your IDE (free)

How to use
toInt
method
in
org.apache.mina.filter.firewall.Subnet

Best Java code snippets using org.apache.mina.filter.firewall.Subnet.toInt (Showing top 6 results out of 315)

origin: kaazing/gateway

/**
 * Converts an IP address to a subnet using the provided 
 * mask
 * @param address The address to convert into a subnet
 * @return The subnet as an integer
 */
private int toSubnet(InetAddress address) {
  return toInt(address) & subnetMask;
}

origin: org.apache.mina/mina-core

/**
 * Converts an IP address to a subnet using the provided mask
 * 
 * @param address
 *            The address to convert into a subnet
 * @return The subnet as an integer
 */
private long toSubnet(InetAddress address) {
  if (address instanceof Inet4Address) {
    return toInt(address) & (int) subnetMask;
  } else {
    return toLong(address) & subnetMask;
  }
}
origin: kaazing/gateway

/**
 * Creates a subnet from CIDR notation. For example, the subnet
 * 192.168.0.0/24 would be created using the {@link InetAddress}  
 * 192.168.0.0 and the mask 24.
 * @param subnet The {@link InetAddress} of the subnet
 * @param mask The mask
 */
public Subnet(InetAddress subnet, int mask) {
  if(subnet == null) {
    throw new NullPointerException("Subnet address can not be null");
  }
  if(!(subnet instanceof Inet4Address)) {
    throw new IllegalArgumentException("Only IPv4 supported");
  }
  if(mask < 0 || mask > 32) {
    throw new IllegalArgumentException("Mask has to be an integer between 0 and 32");
  }
  
  this.subnet = subnet;
  this.subnetInt = toInt(subnet);
  this.suffix = mask;
  
  // binary mask for this subnet
  this.subnetMask = IP_MASK >> (mask - 1);
}
origin: org.apache.directory.api/api-ldap-client-all

/**
 * Converts an IP address to a subnet using the provided mask
 * 
 * @param address
 *            The address to convert into a subnet
 * @return The subnet as an integer
 */
private long toSubnet(InetAddress address) {
  if (address instanceof Inet4Address) {
    return toInt(address) & (int) subnetMask;
  } else {
    return toLong(address) & subnetMask;
  }
}
origin: org.apache.mina/mina-core

} else {
  this.subnet = subnet;
  subnetInt = toInt(subnet);
  this.suffix = mask;
origin: org.apache.directory.api/api-ldap-client-all

} else {
  this.subnet = subnet;
  subnetInt = toInt(subnet);
  this.suffix = mask;
org.apache.mina.filter.firewallSubnettoInt

Javadoc

Converts an IP address into an integer

Popular methods of Subnet

  • <init>
    Creates a subnet from CIDR notation. For example, the subnet 192.168.0.0/24 would be created using t
  • inSubnet
    Checks if the InetAddress is within this subnet
  • toSubnet
    Converts an IP address to a subnet using the provided mask
  • toLong
    Converts an IP address into a long

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSharedPreferences (Context)
  • scheduleAtFixedRate (Timer)
  • putExtra (Intent)
  • Menu (java.awt)
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JButton (javax.swing)
  • JFileChooser (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now