java.lang.Object
org.sentrysoftware.metricshub.engine.awk.Awk

public class Awk extends Object
Utility class for working with AWK scripts.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Awk()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.sentrysoftware.jawk.intermediate.AwkTuples
    Generates the "Awk Tuples", i.e.
    static String
    interpret(String input, String script)
    Interprets the specified Awk script against an input string.
    static String
    interpret(String input, org.sentrysoftware.jawk.intermediate.AwkTuples intermediateCode)
    Interprets the specified Awk intermediate code against an input string.
    static String
    interpret(String input, org.sentrysoftware.jawk.intermediate.AwkTuples intermediateCode, Charset charset)
    Interprets the specified Awk intermediate code against an input string.

    Methods inherited from class java.lang.Object

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

    • Awk

      public Awk()
  • Method Details

    • getIntermediateCode

      public static org.sentrysoftware.jawk.intermediate.AwkTuples getIntermediateCode(String script) throws ParseException
      Generates the "Awk Tuples", i.e. the intermediate Awk code that can be interpreted afterward.
      Parameters:
      script - Awk script source code to be converted to intermediate code
      Returns:
      The actual AwkTuples to be interpreted
      Throws:
      ParseException - when the Awk script is wrong
    • interpret

      public static String interpret(String input, org.sentrysoftware.jawk.intermediate.AwkTuples intermediateCode, Charset charset)
      Interprets the specified Awk intermediate code against an input string. If something goes wrong with the interpretation of the code, a RuntimeException is thrown.
      Parameters:
      input - The text input to be parsed by the Awk script
      intermediateCode - The Awk intermediate code
      charset - A named mapping between sequences of sixteen-bit Unicode code units and sequences of bytes used to set the input as bytes in the AwkSettings
      Returns:
      The result of the Awk script (i.e. what has been printed by the script)
    • interpret

      public static String interpret(String input, org.sentrysoftware.jawk.intermediate.AwkTuples intermediateCode)
      Interprets the specified Awk intermediate code against an input string. If something goes wrong with the interpretation of the code, a RuntimeException is thrown.
      Parameters:
      input - The text input to be parsed by the Awk script
      intermediateCode - The Awk intermediate code
      Returns:
      The result of the Awk script (i.e. what has been printed by the script)
    • interpret

      public static String interpret(String input, String script) throws ParseException
      Interprets the specified Awk script against an input string. If something goes wrong with the interpretation of the code, a RuntimeException is thrown.
      Parameters:
      input - The text input to be parsed by the Awk script
      script - The Awk script to interpret
      Returns:
      The result of the Awk script (i.e. what has been printed by the script)
      Throws:
      ParseException - when the Awk script is wrong