inet.ipaddr

Class IPAddressNetwork.HostNameCache

  • java.lang.Object
    • inet.ipaddr.IPAddressNetwork.HostNameCache
  • Enclosing class:
    IPAddressNetwork


    public static class IPAddressNetwork.HostNameCache
    extends java.lang.Object
    Choose a map of your choice to implement a cache of host names and resolved addresses. The map will map string representations of the host to HostName objects. Those HostName objects in turn cache any resulting IPAddressString objects if the string represents an address, or any IPAddress objects obtained from resolving the HostName. Those objects are all themselves thread-safe, but the cache will only be thread-safe if you choose a thread-safe map such as ConcurrentHashMap.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean contains(T value)
      Returns whether the given instance is in the cache.
      HostName get(byte[] bytes) 
      HostName get(byte[] bytes, byte[] bytes2, java.lang.Integer prefixLength) 
      HostName get(byte[] bytes, byte[] bytes2, java.lang.Integer prefixLength, java.lang.String zone) 
      HostName get(java.lang.String key)
      Gets the object for the given key.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HostNameCache

        public HostNameCache(java.util.Map<java.lang.String,HostName> backingMap)
    • Method Detail

      • get

        public HostName get(java.lang.String key)
        Gets the object for the given key. If the object does not exist yet then it is created and added to the cache.
        Returns:
        the object for the given key
      • get

        public HostName get(byte[] bytes)
      • get

        public HostName get(byte[] bytes,
                            byte[] bytes2,
                            java.lang.Integer prefixLength)
      • get

        public HostName get(byte[] bytes,
                            byte[] bytes2,
                            java.lang.Integer prefixLength,
                            java.lang.String zone)
      • contains

        public boolean contains(T value)
        Returns whether the given instance is in the cache.
        Parameters:
        value -
        Returns:
        whether the given instance of T is in the cache