Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.util
Class ReplacingInputStream

    java.lang.Object
      java.io.InputStream
          java.io.FilterInputStream
              org.apache.poi.util.ReplacingInputStream

All Implemented Interfaces:
  java.io.Closeable

Direct Known Subclasses:
  EvilUnclosedBRFixingInputStream

    @Internal
    public class ReplacingInputStream

extends java.io.FilterInputStream

Simple FilterInputStream that can replace occurrences of bytes with something else. This has been taken from inbot-utils. (MIT licensed)

See Also:
  inbot-utils

Field Summary

Fields inherited from class java.io.FilterInputStream
`in`

Constructor Summary
`ReplacingInputStream(java.io.InputStream in, byte[] pattern, byte[] replacement)` Replace occurrences of pattern in the input.
`ReplacingInputStream(java.io.InputStream in, java.lang.String pattern, java.lang.String replacement)` Replace occurrences of pattern in the input.

Method Summary
`int` | `read()`
`int` | `read(byte[] b)`
`int` | `read(byte[] b, int off, int len)`
`java.lang.String` | `toString()`

Methods inherited from class java.io.FilterInputStream
`available, close, mark, markSupported, reset, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ReplacingInputStream

    public ReplacingInputStream(java.io.InputStream in,
                                java.lang.String pattern,
                                java.lang.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(java.io.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

Method Detail

### read

    public int read(byte[] b,
                    int off,
                    int len)
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.FilterInputStream`
  Throws:
    `java.io.IOException`

### read

    public int read(byte[] b)
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.FilterInputStream`
  Throws:
    `java.io.IOException`

### read

    public int read()
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.FilterInputStream`
  Throws:
    `java.io.IOException`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2017 The Apache Software Foundation or its licensors, as applicable.