i2p.susi.util

## Class RegexOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - java.io.FilterOutputStream
    - - i2p.susi.util.RegexOutputStream

- All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

      public class RegexOutputStream
      extends FilterOutputStream

  OutputStream that performs case-insensitive regex replacement during streaming.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) int` | `idx`

    - ### Fields inherited from class java.io.FilterOutputStream

      `out`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RegexOutputStream(OutputStream out, String pattern, String replace, String onNoMatch)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `static void` | `main(String[] args)`
    `void` | `write(int val)`

    - ### Methods inherited from class java.io.FilterOutputStream

      `flush, write, write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### idx

          int idx

  - ### Constructor Detail

    - #### RegexOutputStream

          public RegexOutputStream(OutputStream out,
                                   String pattern,
                                   String replace,
                                   String onNoMatch)

      Parameters:
        `out` - MUST be buffered because this writes one byte at a time
        `pattern` - the only special char recognized is '*' and cannot be at the beginning or end or have two in a row. ASCII-only, no UTF-8.
        `replace` - ASCII-only, no UTF-8.
        `onNoMatch` - force output of this at the end if no replacement made, or null

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `FilterOutputStream`
      Throws:
        `IOException`

    - #### main

          public static void main(String[] args)
                           throws Exception

      Throws:
        `Exception`

    - #### write

          public void write(int val)
                     throws IOException

      Overrides:
        `write` in class `FilterOutputStream`
      Throws:
        `IOException`