Package ua_parser

Class Parser

java.lang.Object
ua_parser.Parser
Direct Known Subclasses:
CachingParser

public class Parser extends Object
Java implementation of UA Parser
Author:
Steve Jiang (@sjiang) <gh at iamsteve com>
  • Field Details

  • Constructor Details

    • Parser

      public Parser()
      Creates a parser using the regular expression yaml file bundled in the jar.
      Throws:
      RuntimeException - if there's a problem reading the file from the classpath
    • Parser

      public Parser(org.yaml.snakeyaml.LoaderOptions loaderOptions)
      Creates a parser using the regular expression yaml file bundled in the jar.
      Parameters:
      loaderOptions - configuration for loading parser safe limits.
      Throws:
      RuntimeException - if there's a problem reading the file from the classpath.
    • Parser

      public Parser(InputStream regexYaml)
      Creates a parser using the supplied regular expression yaml file. It is the responsibility of the caller to close the InputStream after construction.
      Parameters:
      regexYaml - the yaml file containing the regular expressions
    • Parser

      public Parser(InputStream regexYaml, org.yaml.snakeyaml.LoaderOptions loaderOptions)
      Creates a parser using the supplied regular expression yaml file. It is the responsibility of the caller to close the InputStream after construction.
      Parameters:
      regexYaml - the yaml file containing the regular expressions
      loaderOptions - configuration for loading parser safe limits.
  • Method Details

    • parse

      public Client parse(String agentString)
    • parseUserAgent

      public UserAgent parseUserAgent(String agentString)
    • parseDevice

      public Device parseDevice(String agentString)
    • parseOS

      public OS parseOS(String agentString)
    • getDefaultLoaderOptions

      public static org.yaml.snakeyaml.LoaderOptions getDefaultLoaderOptions()