Class ReplacingInputStream

    • Constructor Detail

      • ReplacingInputStream

        public ReplacingInputStream​(InputStream in,
                                    String pattern,
                                    String replacement)
        Replace occurrences of pattern in the input. Note: input is assumed to be UTF-8 encoded. If not the case use byte[] based pattern and replacement.
        Parameters:
        in - input
        pattern - pattern to replace.
        replacement - the replacement or null
      • ReplacingInputStream

        public ReplacingInputStream​(InputStream in,
                                    byte[] pattern,
                                    byte[] replacement)
        Replace occurrences of pattern in the input.

        If you want to normalize line endings DOS/MAC (\n\r | \r) to UNIX (\n), you can call the following:
        new ReplacingInputStream(new ReplacingInputStream(is, "\n\r", "\n"), "\r", "\n")

        Parameters:
        in - input
        pattern - pattern to replace
        replacement - the replacement or null