Class Awk
java.lang.Object
org.sentrysoftware.metricshub.engine.awk.Awk
Utility class for working with AWK scripts.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.sentrysoftware.jawk.intermediate.AwkTuplesgetIntermediateCode(String script) Generates the "Awk Tuples", i.e.static StringInterprets the specified Awk script against an input string.static StringInterprets the specified Awk intermediate code against an input string.static Stringinterpret(String input, org.sentrysoftware.jawk.intermediate.AwkTuples intermediateCode, Charset charset) Interprets the specified Awk intermediate code against an input string.
-
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, aRuntimeExceptionis thrown.- Parameters:
input- The text input to be parsed by the Awk scriptintermediateCode- The Awk intermediate codecharset- A named mapping between sequences of sixteen-bit Unicode code units and sequences of bytes used to set the input as bytes in theAwkSettings- 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, aRuntimeExceptionis thrown.- Parameters:
input- The text input to be parsed by the Awk scriptintermediateCode- The Awk intermediate code- Returns:
- The result of the Awk script (i.e. what has been printed by the script)
-
interpret
Interprets the specified Awk script against an input string. If something goes wrong with the interpretation of the code, aRuntimeExceptionis thrown.- Parameters:
input- The text input to be parsed by the Awk scriptscript- 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
-