org.apache.commons.io.build

## Class AbstractOrigin.OutputStreamOrigin

- java.lang.Object
- - org.apache.commons.io.build.AbstractSupplier<T,B>
  - - org.apache.commons.io.build.AbstractOrigin<OutputStream,AbstractOrigin.OutputStreamOrigin>
    - - org.apache.commons.io.build.AbstractOrigin.OutputStreamOrigin

- All Implemented Interfaces:
    IOSupplier<OutputStream>
  Enclosing class:
    AbstractOrigin<T,B extends AbstractOrigin<T,B>>

      public static class AbstractOrigin.OutputStreamOrigin
      extends AbstractOrigin<OutputStream,AbstractOrigin.OutputStreamOrigin>

  An `OutputStream` origin.

  This origin cannot provide some of the other aspects.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.commons.io.build.AbstractOrigin

      `AbstractOrigin.AbstractRandomAccessFileOrigin<T extends RandomAccessFile,B extends AbstractOrigin.AbstractRandomAccessFileOrigin<T,B>>, AbstractOrigin.ByteArrayOrigin, AbstractOrigin.CharSequenceOrigin, AbstractOrigin.FileOrigin, AbstractOrigin.InputStreamOrigin, AbstractOrigin.IORandomAccessFileOrigin, AbstractOrigin.OutputStreamOrigin, AbstractOrigin.PathOrigin, AbstractOrigin.RandomAccessFileOrigin, AbstractOrigin.ReaderOrigin, AbstractOrigin.URIOrigin, AbstractOrigin.WriterOrigin`

  - ### Field Summary

    - ### Fields inherited from class org.apache.commons.io.build.AbstractOrigin

      `origin`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OutputStreamOrigin(OutputStream origin)` Constructs a new instance for the given origin.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `OutputStream` | `getOutputStream(OpenOption... options)` Gets this origin as an OutputStream, if possible.
    `Writer` | `getWriter(Charset charset, OpenOption... options)` Gets a new Writer on the origin, buffered by default.

    - ### Methods inherited from class org.apache.commons.io.build.AbstractOrigin

      `get, getByteArray, getByteArray, getCharSequence, getFile, getInputStream, getPath, getRandomAccessFile, getReader, size, toString`

    - ### Methods inherited from class org.apache.commons.io.build.AbstractSupplier

      `asThis`

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

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

    - ### Methods inherited from interface org.apache.commons.io.function.IOSupplier

      `asSupplier, getUnchecked`

- - ### Constructor Detail

    - #### OutputStreamOrigin

          public OutputStreamOrigin(OutputStream origin)

      Constructs a new instance for the given origin.
      Parameters:
        `origin` - The origin, not null.

  - ### Method Detail

    - #### getOutputStream

          public OutputStream getOutputStream(OpenOption... options)

      Gets this origin as an OutputStream, if possible.

      The `options` parameter is ignored since a `OutputStream` does not need an `OpenOption` to be written.

      Overrides:
        `getOutputStream` in class `AbstractOrigin<OutputStream,AbstractOrigin.OutputStreamOrigin>`
      Parameters:
        `options` - options specifying how the file is opened
      Returns:
        this origin as an OutputStream, if possible.

    - #### getWriter

          public Writer getWriter(Charset charset,
                                  OpenOption... options)
                           throws IOException

      Gets a new Writer on the origin, buffered by default.

      The `options` parameter is ignored since a `OutputStream` does not need an `OpenOption` to be written.

      Overrides:
        `getWriter` in class `AbstractOrigin<OutputStream,AbstractOrigin.OutputStreamOrigin>`
      Parameters:
        `charset` - the charset to use for encoding
        `options` - options specifying how the file is opened
      Returns:
        a new Writer on the origin.
      Throws:
        `IOException` - if an I/O error occurs opening or creating the file.