org.apache.commons.io.build

## Class AbstractOriginSupplier<T,B extends AbstractOriginSupplier<T,B>>

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

- Type Parameters:
    `T` - the type of instances to build.
    `B` - the type of builder subclass.
  All Implemented Interfaces:
    IOSupplier<T>
  Direct Known Subclasses:
    AbstractStreamBuilder

      public abstract class AbstractOriginSupplier<T,B extends AbstractOriginSupplier<T,B>>
      extends AbstractSupplier<T,B>

  Abstracts building an instance of `T`.
  Since:
    2.12.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractOriginSupplier()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected AbstractOrigin<?,?>` | `checkOrigin()` Checks whether the origin is null.
    `protected AbstractOrigin<?,?>` | `getOrigin()` Gets the origin.
    `protected boolean` | `hasOrigin()` Tests whether the origin is null.
    `protected static AbstractOrigin.ByteArrayOrigin` | `newByteArrayOrigin(byte[] origin)` Creates a new byte array origin for a byte array.
    `protected static AbstractOrigin.CharSequenceOrigin` | `newCharSequenceOrigin(CharSequence origin)` Creates a new CharSequence origin for a CharSequence.
    `protected static AbstractOrigin.FileOrigin` | `newFileOrigin(File origin)` Creates a new file origin for a file.
    `protected static AbstractOrigin.FileOrigin` | `newFileOrigin(String origin)` Creates a new file origin for a file path.
    `protected static AbstractOrigin.InputStreamOrigin` | `newInputStreamOrigin(InputStream origin)` Creates a new input stream origin for a file.
    `protected static AbstractOrigin.OutputStreamOrigin` | `newOutputStreamOrigin(OutputStream origin)` Creates a new output stream origin for a file.
    `protected static AbstractOrigin.PathOrigin` | `newPathOrigin(Path origin)` Creates a new path origin for a file.
    `protected static AbstractOrigin.PathOrigin` | `newPathOrigin(String origin)` Creates a new path name origin for a path name.
    `protected static AbstractOrigin.ReaderOrigin` | `newReaderOrigin(Reader origin)` Creates a new reader origin for a reader.
    `protected static AbstractOrigin.URIOrigin` | `newURIOrigin(URI origin)` Creates a new reader origin for a URI.
    `protected static AbstractOrigin.WriterOrigin` | `newWriterOrigin(Writer origin)` Creates a new writer origin for a file.
    `B` | `setByteArray(byte[] origin)` Sets a new origin.
    `B` | `setCharSequence(CharSequence origin)` Sets a new origin.
    `B` | `setFile(File origin)` Sets a new origin.
    `B` | `setFile(String origin)` Sets a new origin.
    `B` | `setInputStream(InputStream origin)` Sets a new origin.
    `protected B` | `setOrigin(AbstractOrigin<?,?> origin)` Sets a new origin.
    `B` | `setOutputStream(OutputStream origin)` Sets a new origin.
    `B` | `setPath(Path origin)` Sets a new origin.
    `B` | `setPath(String origin)` Sets a new origin.
    `B` | `setReader(Reader origin)` Sets a new origin.
    `B` | `setURI(URI origin)` Sets a new origin.
    `B` | `setWriter(Writer origin)` Sets a new origin.

    - ### 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, toString, wait, wait, wait`

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

      `asSupplier, get`

- - ### Constructor Detail

    - #### AbstractOriginSupplier

          public AbstractOriginSupplier()

  - ### Method Detail

    - #### newByteArrayOrigin

          protected static AbstractOrigin.ByteArrayOrigin newByteArrayOrigin(byte[] origin)

      Creates a new byte array origin for a byte array.
      Parameters:
        `origin` - the byte array.
      Returns:
        a new byte array origin.

    - #### newCharSequenceOrigin

          protected static AbstractOrigin.CharSequenceOrigin newCharSequenceOrigin(CharSequence origin)

      Creates a new CharSequence origin for a CharSequence.
      Parameters:
        `origin` - the CharSequence.
      Returns:
        a new file origin.
      Since:
        2.13.0

    - #### newFileOrigin

          protected static AbstractOrigin.FileOrigin newFileOrigin(File origin)

      Creates a new file origin for a file.
      Parameters:
        `origin` - the file.
      Returns:
        a new file origin.

    - #### newFileOrigin

          protected static AbstractOrigin.FileOrigin newFileOrigin(String origin)

      Creates a new file origin for a file path.
      Parameters:
        `origin` - the file path.
      Returns:
        a new file origin.

    - #### newInputStreamOrigin

          protected static AbstractOrigin.InputStreamOrigin newInputStreamOrigin(InputStream origin)

      Creates a new input stream origin for a file.
      Parameters:
        `origin` - the input stream.
      Returns:
        a new input stream origin.

    - #### newOutputStreamOrigin

          protected static AbstractOrigin.OutputStreamOrigin newOutputStreamOrigin(OutputStream origin)

      Creates a new output stream origin for a file.
      Parameters:
        `origin` - the output stream.
      Returns:
        a new output stream origin.

    - #### newPathOrigin

          protected static AbstractOrigin.PathOrigin newPathOrigin(Path origin)

      Creates a new path origin for a file.
      Parameters:
        `origin` - the path.
      Returns:
        a new path origin.

    - #### newPathOrigin

          protected static AbstractOrigin.PathOrigin newPathOrigin(String origin)

      Creates a new path name origin for a path name.
      Parameters:
        `origin` - the path name.
      Returns:
        a new path name origin.

    - #### newReaderOrigin

          protected static AbstractOrigin.ReaderOrigin newReaderOrigin(Reader origin)

      Creates a new reader origin for a reader.
      Parameters:
        `origin` - the reader.
      Returns:
        a new reader origin.

    - #### newURIOrigin

          protected static AbstractOrigin.URIOrigin newURIOrigin(URI origin)

      Creates a new reader origin for a URI.
      Parameters:
        `origin` - the URI.
      Returns:
        a new URI origin.

    - #### newWriterOrigin

          protected static AbstractOrigin.WriterOrigin newWriterOrigin(Writer origin)

      Creates a new writer origin for a file.
      Parameters:
        `origin` - the writer.
      Returns:
        a new writer .

    - #### checkOrigin

          protected AbstractOrigin<?,?> checkOrigin()

      Checks whether the origin is null.
      Returns:
        the origin.
      Throws:
        `IllegalStateException` - if the `origin` is `null`.

    - #### getOrigin

          protected AbstractOrigin<?,?> getOrigin()

      Gets the origin.
      Returns:
        the origin.

    - #### hasOrigin

          protected boolean hasOrigin()

      Tests whether the origin is null.
      Returns:
        whether the origin is null.

    - #### setByteArray

          public B setByteArray(byte[] origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this

    - #### setCharSequence

          public B setCharSequence(CharSequence origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this
      Since:
        2.13.0

    - #### setFile

          public B setFile(File origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this

    - #### setFile

          public B setFile(String origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this

    - #### setInputStream

          public B setInputStream(InputStream origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this

    - #### setOrigin

          protected B setOrigin(AbstractOrigin<?,?> origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this

    - #### setOutputStream

          public B setOutputStream(OutputStream origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this

    - #### setPath

          public B setPath(Path origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this

    - #### setPath

          public B setPath(String origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this

    - #### setReader

          public B setReader(Reader origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this

    - #### setURI

          public B setURI(URI origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this

    - #### setWriter

          public B setWriter(Writer origin)

      Sets a new origin.
      Parameters:
        `origin` - the new origin.
      Returns:
        this

Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.