Package io.jawk.jrt

Class OutputStreamAwkSink

java.lang.Object
io.jawk.jrt.AwkSink
io.jawk.jrt.OutputStreamAwkSink

public final class OutputStreamAwkSink extends AwkSink
Text AwkSink backed by a PrintStream.
  • Constructor Details

    • OutputStreamAwkSink

      public OutputStreamAwkSink(OutputStream outputStream)
      Creates a sink backed by an OutputStream.
      Parameters:
      outputStream - stream that should receive AWK output
    • OutputStreamAwkSink

      public OutputStreamAwkSink(OutputStream outputStream, Locale locale)
      Creates a sink backed by an OutputStream.
      Parameters:
      outputStream - stream that should receive AWK output
      locale - locale used for numeric formatting
    • OutputStreamAwkSink

      public OutputStreamAwkSink(PrintStream printStream)
      Creates a sink backed directly by a PrintStream.
      Parameters:
      printStream - stream that should receive AWK output
    • OutputStreamAwkSink

      public OutputStreamAwkSink(PrintStream printStream, Locale locale)
      Creates a sink backed directly by a PrintStream.
      Parameters:
      printStream - stream that should receive AWK output
      locale - locale used for numeric formatting
  • Method Details

    • print

      public void print(String ofs, String ors, String ofmt, Object... values)
      Description copied from class: AwkSink
      Writes one AWK print operation.
      Specified by:
      print in class AwkSink
      Parameters:
      ofs - output field separator
      ors - output record separator
      ofmt - numeric output format used by plain print
      values - values supplied to print
    • printf

      public void printf(String ofs, String ors, String ofmt, String format, Object... values)
      Description copied from class: AwkSink
      Writes one AWK printf operation.
      Specified by:
      printf in class AwkSink
      Parameters:
      ofs - output field separator
      ors - output record separator
      ofmt - numeric output format available to the sink
      format - format string passed to printf
      values - arguments supplied after the format string
    • flush

      public void flush()
      Description copied from class: AwkSink
      Flushes any buffered output held by this sink.
      Overrides:
      flush in class AwkSink
    • getPrintStream

      public PrintStream getPrintStream()
      Description copied from class: AwkSink
      Returns a PrintStream view that receives raw process output written by spawned commands such as system("...").

      The default implementation returns a stream that silently discards all output. Override this method in sinks that need to capture process output.

      Overrides:
      getPrintStream in class AwkSink
      Returns:
      print stream that should receive raw process output