Class Internet


public class Internet extends AbstractProvider<BaseProviders>
Since:
0.8.0
  • Field Details

    • DIACRITICS_AND_FRIENDS

      public static final Pattern DIACRITICS_AND_FRIENDS
  • Constructor Details

  • Method Details

    • username

      @Deprecated(since="2.5.0", forRemoval=true) public String username()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since 2.5.0. Use Credentials.username() instead.
      A lowercase username composed of the first_name and last_name joined with a '.'. Some examples are:
      Returns:
      a random two part username.
      See Also:
    • emailAddress

      public String emailAddress()
    • emailAddress

      public String emailAddress(String name)
      Returns an email address based on the provided name and a random domain (from "internet.free_email").

      Example usage:

       
       faker.internet().emailAddress("Hal")); // hal@gmail.com
       faker.internet().emailAddress("John McClane")); // john.mcclane@yahoo.com
       faker.internet().emailAddress("Stephen Vincent Strange")); // stephen.strange@hotmail.com
       faker.internet().emailAddress("Dr. Henry Indiana Jones Jr.")); // henry.jones@gmail.com
       faker.internet().emailAddress("Jeanne d'Arc")); // jeanne.darc@yahoo.com
       
       
      Parameters:
      name - The name to be used for generating the local part of the email address.
      Returns:
      A String representing an email address.
      See Also:
    • safeEmailAddress

      public String safeEmailAddress()
    • safeEmailAddress

      public String safeEmailAddress(String name)
      Returns an email address based on the provided name and a safe domain (from "internet.safe_email").
       
       faker.internet().safeEmailAddress("John McClane")); // john.mcclane@example.com
       
       
      Parameters:
      name - The name to be used for generating the local part of the email address.
      Returns:
      A String representing an email address.
      See Also:
    • emailSubject

      public String emailSubject()
    • domainName

      public String domainName()
    • domainWord

      public String domainWord()
    • domainSuffix

      public String domainSuffix()
    • url

      public String url()
      Returns a string representing a web URL, randomly including: http/https scheme, port, path elements (2 or none), file element (1 or none), params (2 or none), anchor (1 or none).
      Returns:
      a web URL
      Since:
      2.0.0
    • url

      public String url(boolean schemeChoice, boolean portChoice, boolean pathChoice, boolean fileChoice, boolean paramsChoice, boolean anchorChoice)
      Returns a string representing a web URL, with various elements controlled by the caller.
      Parameters:
      schemeChoice - if true will be random http or https, if false will be https
      portChoice - if true a random port will be included, if false no port will be included
      pathChoice - if true two random path elements will be included, if false no path elements will be included
      fileChoice - if true the path will end with a random word element instead of a slash, if false it will end with a slash
      paramsChoice - if true two random name value pairs will be included, if false no params will be included
      anchorChoice - if true a random anchor will be included, if false no anchor will be included
      Returns:
      a web URL
      Since:
      2.0.0
    • webdomain

      public String webdomain()
      Returns a web domain.
      Returns:
      a web domain in the form "www.example.com"
      Since:
      2.0.0
    • image

      public String image()
    • image

      public String image(int width, int height)
    • image

      public String image(int width, int height, String seed)
    • httpMethod

      public String httpMethod()
    • password

      @Deprecated(since="2.5.0", forRemoval=true) public String password()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 2.5.0. Use Credentials.password() instead.
    • password

      @Deprecated(since="2.5.0", forRemoval=true) public String password(boolean includeDigit)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 2.5.0. Use Credentials.password(boolean) instead.
    • password

      @Deprecated(since="2.5.0", forRemoval=true) public String password(int minimumLength, int maximumLength)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 2.5.0. Use Credentials.password(int, int) instead.
    • password

      @Deprecated(since="2.5.0", forRemoval=true) public String password(int minimumLength, int maximumLength, boolean includeUppercase)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 2.5.0. Use Credentials.password(int, int, boolean) instead.
    • password

      @Deprecated(since="2.5.0", forRemoval=true) public String password(int minimumLength, int maximumLength, boolean includeUppercase, boolean includeSpecial)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • password

      @Deprecated(since="2.5.0", forRemoval=true) public String password(int minimumLength, int maximumLength, boolean includeUppercase, boolean includeSpecial, boolean includeDigit)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • port

      public int port()
      Returns a port number between 0 and 65535
      Returns:
      a port number
    • port

      public int port(Internet.PortRange range)
      Returns a port number within given range
      Parameters:
      range - either Well-Known Ports (0-1023), Registered Ports (1024-49151) or Dynamic/Private Ports (49152-65535)
      Returns:
      a port number
    • port

      public int port(int from, int to)
      Returns a port number between from and to (inclusive)
      Parameters:
      from - minimum port number (must not be less than 0)
      to - maximum port number (must not be greater than 65535)
      Returns:
      a port number within given range
    • 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()
      returns an IPv4 address.
      Returns:
      an IPv4 address.
    • privateIpV4Address

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

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

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

      public InetAddress getPublicIpV4Address()
      Returns:
      a valid public IPV4 address
    • 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()

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

      Returns:
      a IPV6 address.
    • 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)
    • uuidv3

      public String uuidv3()
      Returns a UUID (type 3) as String. Use this method (instead of uuid) if you are using a constant random seed and require the same output for different faker instances. *
      Returns:
      a uuid as string.
    • uuidv4

      public String uuidv4()
    • uuidv7

      public String uuidv7()
    • uuid

      public String uuid()
      Returns a UUID (type 4) as String.

      This returns a repeatable version of a version 4 UUID, which is a bit against the idea of a version 4 UUID, but this is a faker library, not a UUID library.

      Returns:
      a v4 uuid as string.
    • userAgent

      public String userAgent(Internet.UserAgent userAgent)
    • userAgent

      public String userAgent()
    • botUserAgent

      public String botUserAgent(Internet.BotUserAgent vendor)
    • botUserAgentAny

      public String botUserAgentAny()