Package net.datafaker

Class Internet

java.lang.Object
net.datafaker.Internet

public class Internet extends Object
Since:
0.8.0
  • Field Details

    • DIACRITICS_AND_FRIENDS

      public static final Pattern DIACRITICS_AND_FRIENDS
  • Constructor Details

    • Internet

      protected Internet(Faker faker)
  • Method Details

    • emailAddress

      public String emailAddress()
    • emailAddress

      public String emailAddress(String localPart)
    • safeEmailAddress

      public String safeEmailAddress()
    • safeEmailAddress

      public String safeEmailAddress(String localPart)
    • domainName

      public String domainName()
    • domainWord

      public String domainWord()
    • domainSuffix

      public String domainSuffix()
    • url

      public String url()
    • avatar

      @Deprecated public String avatar()
      Deprecated.
      use faker.avatar.image() instead
    • image

      public String image()
      Generates a random image url based on the lorempixel service. All the images provided by this service are released under the creative commons license (CC BY-SA). For more information, please visit: http://lorempixel.com/
      Returns:
      an url to a random image.
      See Also:
    • image

      public String image(Integer width, Integer height, Boolean gray, String text)
      Same as image() but allows client code to choose a few image characteristics
      Parameters:
      width - the image width
      height - the image height
      gray - true for gray image and false for color image
      text - optional custom text on the selected picture
      Returns:
      an url to a random image with the given characteristics.
    • password

      public String password()
    • password

      public String password(boolean includeDigit)
    • password

      public String password(int minimumLength, int maximumLength)
    • password

      public String password(int minimumLength, int maximumLength, boolean includeUppercase)
    • password

      public String password(int minimumLength, int maximumLength, boolean includeUppercase, boolean includeSpecial)
    • password

      public String password(int minimumLength, int maximumLength, boolean includeUppercase, boolean includeSpecial, boolean includeDigit)
    • macAddress

      public String macAddress(String prefix)

      Returns a MAC address in the following format: 6-bytes in MM:MM:MM:SS:SS:SS format.

      Parameters:
      prefix - a prefix to put on the front of the address
      Returns:
      a correctly formatted MAC address
    • macAddress

      public String macAddress()
      See Also:
    • ipV4Address

      public String ipV4Address()
      returns an IPv4 address in dot separated octets.
      Returns:
      a correctly formatted IPv4 address.
    • getIpV4Address

      public InetAddress getIpV4Address() throws UnknownHostException
      returns an IPv4 address.
      Returns:
      an IPv4 address.
      Throws:
      UnknownHostException
    • privateIpV4Address

      public String privateIpV4Address()
      Returns:
      a valid private IPV4 address in dot notation
    • getPrivateIpV4Address

      public InetAddress getPrivateIpV4Address() throws UnknownHostException
      Returns:
      a private IPV4 address
      Throws:
      UnknownHostException
    • publicIpV4Address

      public String publicIpV4Address()
      Returns:
      a valid public IPV4 address in dot notation
    • getPublicIpV4Address

      public InetAddress getPublicIpV4Address() throws UnknownHostException
      Returns:
      a valid public IPV4 address
      Throws:
      UnknownHostException
    • ipV4Cidr

      public String ipV4Cidr()
      Returns:
      a valid IPV4 CIDR
    • ipV6Address

      public String ipV6Address()

      Returns an IPv6 address in hh:hh:hh:hh:hh:hh:hh:hh format.

      Returns:
      a correctly formatted IPv6 address.
    • getIpV6Address

      public InetAddress getIpV6Address() throws UnknownHostException

      Returns an IPv6 address in hh:hh:hh:hh:hh:hh:hh:hh format.

      Returns:
      a IPV6 address.
      Throws:
      UnknownHostException
    • ipV6Cidr

      public String ipV6Cidr()
      Returns:
      a valid IPV6 CIDR
    • slug

      public String slug()
      Returns:
      a slug using '_' as the word separator and two Lorem words as the values
    • slug

      public String slug(List<String> wordsOrNull, String glueOrNull)
      Parameters:
      wordsOrNull - if null, then 2 Lorem words
      glueOrNull - if null, "_"
      Returns:
      a slug string combining wordsOrNull with glueOrNull (ex. x_y)
    • uuid

      public String uuid()
      Returns a UUID (type 4) as String.
      Returns:
      A UUID as String.
    • userAgent

      public String userAgent(Internet.UserAgent userAgent)
    • userAgentAny

      public String userAgentAny()