Package org.apache.commons.io.input

# Class MarkShieldInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.commons.io.input.ProxyInputStream
org.apache.commons.io.input.MarkShieldInputStream

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class MarkShieldInputStream extends ProxyInputStream
This is an alternative to `ByteArrayInputStream` which removes the synchronization overhead for non-concurrent access; as such this class is not thread-safe. Proxy stream that prevents the underlying input stream from being marked/reset.

This class is typically used in cases where an input stream that supports marking needs to be passed to a component that wants to explicitly mark the stream, but it is not desirable to allow marking of the stream.

Since:
  2.8.0

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.commons.io.input.ProxyInputStream

  `ProxyInputStream.AbstractBuilder<T,B extends AbstractStreamBuilder<T,B>>`

- ## Field Summary

  ### Fields inherited from class java.io.FilterInputStream

  `in`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MarkShieldInputStream(InputStream in)`
  Constructs a proxy that shields the given input stream from being marked or rest.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `mark(int readLimit)`
  Invokes the delegate's `InputStream.mark(int)` method.
  `boolean`
  `markSupported()`
  Invokes the delegate's `InputStream.markSupported()` method.
  `void`
  `reset()`
  Invokes the delegate's `InputStream.reset()` method.

  ### Methods inherited from class org.apache.commons.io.input.ProxyInputStream

  `afterRead, available, beforeRead, close, handleIOException, read, read, read, setReference, skip, unwrap`

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

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

- ## Constructor Details

  - ### MarkShieldInputStream

    public MarkShieldInputStream(InputStream in)
    Constructs a proxy that shields the given input stream from being marked or rest.
    Parameters:
      `in` - underlying input stream

- ## Method Details

  - ### mark

    public void mark(int readLimit)
    Description copied from class: `ProxyInputStream`
    Invokes the delegate's `InputStream.mark(int)` method.
    Overrides:
      `mark` in class `ProxyInputStream`
    Parameters:
      `readLimit` - read ahead limit.

  - ### markSupported

    public boolean markSupported()
    Description copied from class: `ProxyInputStream`
    Invokes the delegate's `InputStream.markSupported()` method.
    Overrides:
      `markSupported` in class `ProxyInputStream`
    Returns:
      `true` if this stream instance supports the mark and reset methods; `false` otherwise.
    See Also:
      - `ProxyInputStream.mark(int)`
      - `ProxyInputStream.reset()`

  - ### reset

    public void reset() throws IOException
    Description copied from class: `ProxyInputStream`
    Invokes the delegate's `InputStream.reset()` method.
    Overrides:
      `reset` in class `ProxyInputStream`
    Throws:
      `IOException` - if this stream has not been marked or if the mark has been invalidated.