org.apache.tamaya.format

## Class InputStreamFactory

- java.lang.Object
- - org.apache.tamaya.format.InputStreamFactory

- All Implemented Interfaces:
    Closeable, AutoCloseable

      public class InputStreamFactory
      extends Object
      implements Closeable

  Wrapper for a given `InputStream` to be able to close it via the try-with-resources construct of Java 7.

  # Usage example

       public void readIt(InputStream inputStream) {
          try (InputStream is = new ParallelInputStream(inputStream) {
              // Consume the stream
          }
       }

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InputStreamFactory(InputStream original)` Creates a bew InputStreamFactory.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `InputStream` | `createInputStream()` Creates a new InputStream with the same data as provided by the InputStream passed on factory creation.

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

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

- - ### Constructor Detail

    - #### InputStreamFactory

          public InputStreamFactory(InputStream original)
                             throws IOException

      Creates a bew InputStreamFactory.
      Parameters:
        `original` - the InputStream to be read for extract its data into memory.
      Throws:
        `IOException` - if thrown by the original during read.

  - ### Method Detail

    - #### createInputStream

          public InputStream createInputStream()
                                        throws IOException

      Creates a new InputStream with the same data as provided by the InputStream passed on factory creation.
      Returns:
        a new InputStream , never null.
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

Copyright © 2014–2015 Apache Software Foundation. All rights reserved.