Class ScriptSource

java.lang.Object
org.sentrysoftware.jawk.util.ScriptSource
Direct Known Subclasses:
ScriptFileSource

public class ScriptSource extends Object
Represents one AWK-script content source. This is usually either a string, given on the command line with the first non-"-" parameter, or an "*.awk" (normal) or "*.ai" (intermediate) script, given as a path with a "-f" command line switch.
Author:
Danny Daglas
  • Field Details

    • DESCRIPTION_COMMAND_LINE_SCRIPT

      public static final String DESCRIPTION_COMMAND_LINE_SCRIPT
      Constant DESCRIPTION_COMMAND_LINE_SCRIPT="<command-line-supplied-script>"
      See Also:
  • Constructor Details

    • ScriptSource

      public ScriptSource(String description, Reader reader, boolean intermediate)

      Constructor for ScriptSource.

      Parameters:
      description - a String object
      reader - a Reader object
      intermediate - a boolean
  • Method Details

    • getDescription

      public final String getDescription()

      Getter for the field description.

      Returns:
      a String object
    • getReader

      public Reader getReader() throws IOException
      Obtain the InputStream containing the intermediate file. This returns non-null only if returns false.
      Returns:
      The reader which contains the intermediate file, null if either the -f argument is not used, or the argument does not refer to an intermediate file.
      Throws:
      IOException - if any.
    • getInputStream

      public InputStream getInputStream() throws IOException
      Returns the InputStream serving the contents of this source. This returns non-null only if returns true.
      Returns:
      a InputStream object
      Throws:
      IOException - if any.
    • isIntermediate

      public final boolean isIntermediate()
      Indicates whether the underlying source is an intermediate file. Intermediate files end with the ".ai" extension. No other determination is made whether the file is an intermediate one or not. That is, the content of the file is not checked.
      Returns:
      true if the "-f optarg" is an intermediate file (a file ending in ".ai"), false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object