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, FileAlterationObserver.Builder

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

  Abstracts building an instance of `T`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractOriginSupplier()` Constructs a new instance for subclasses.

  - ### 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)` Constructs a new byte array origin for a byte array.
    `protected static AbstractOrigin.CharSequenceOrigin` | `newCharSequenceOrigin(CharSequence origin)` Constructs a new CharSequence origin for a CharSequence.
    `protected static AbstractOrigin.FileOrigin` | `newFileOrigin(File origin)` Constructs a new file origin for a file.
    `protected static AbstractOrigin.FileOrigin` | `newFileOrigin(String origin)` Constructs a new file origin for a file path.
    `protected static AbstractOrigin.InputStreamOrigin` | `newInputStreamOrigin(InputStream origin)` Constructs a new input stream origin for a file.
    `protected static AbstractOrigin.OutputStreamOrigin` | `newOutputStreamOrigin(OutputStream origin)` Constructs a new output stream origin for a file.
    `protected static AbstractOrigin.PathOrigin` | `newPathOrigin(Path origin)` Constructs a new path origin for a file.
    `protected static AbstractOrigin.PathOrigin` | `newPathOrigin(String origin)` Constructs a new path name origin for a path name.
    `protected static AbstractOrigin.IORandomAccessFileOrigin` | `newRandomAccessFileOrigin(IORandomAccessFile origin)` Constructs a new RandomAccessFile origin for a RandomAccessFile.
    `protected static AbstractOrigin.RandomAccessFileOrigin` | `newRandomAccessFileOrigin(RandomAccessFile origin)` Constructs a new RandomAccessFile origin for a RandomAccessFile.
    `protected static AbstractOrigin.ReaderOrigin` | `newReaderOrigin(Reader origin)` Constructs a new reader origin for a reader.
    `protected static AbstractOrigin.URIOrigin` | `newURIOrigin(URI origin)` Constructs a new reader origin for a URI.
    `protected static AbstractOrigin.WriterOrigin` | `newWriterOrigin(Writer origin)` Constructs 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` | `setRandomAccessFile(IORandomAccessFile origin)` Sets a new origin.
    `B` | `setRandomAccessFile(RandomAccessFile 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, getUnchecked`

- - ### Constructor Detail

    - #### AbstractOriginSupplier

          public AbstractOriginSupplier()

      Constructs a new instance for subclasses.

  - ### Method Detail

    - #### 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.

    - #### newByteArrayOrigin

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

      Constructs 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)

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

    - #### newFileOrigin

          protected static AbstractOrigin.FileOrigin newFileOrigin(File origin)

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

    - #### newFileOrigin

          protected static AbstractOrigin.FileOrigin newFileOrigin(String origin)

      Constructs 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)

      Constructs 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)

      Constructs 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)

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

    - #### newPathOrigin

          protected static AbstractOrigin.PathOrigin newPathOrigin(String origin)

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

    - #### newRandomAccessFileOrigin

          protected static AbstractOrigin.IORandomAccessFileOrigin newRandomAccessFileOrigin(IORandomAccessFile origin)

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

    - #### newRandomAccessFileOrigin

          protected static AbstractOrigin.RandomAccessFileOrigin newRandomAccessFileOrigin(RandomAccessFile origin)

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

    - #### newReaderOrigin

          protected static AbstractOrigin.ReaderOrigin newReaderOrigin(Reader origin)

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

    - #### newURIOrigin

          protected static AbstractOrigin.URIOrigin newURIOrigin(URI origin)

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

    - #### newWriterOrigin

          protected static AbstractOrigin.WriterOrigin newWriterOrigin(Writer origin)

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

    - #### setByteArray

          public B setByteArray(byte[] origin)

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

    - #### setCharSequence

          public B setCharSequence(CharSequence origin)

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

    - #### setFile

          public B setFile(File origin)

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

    - #### setFile

          public B setFile(String origin)

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

    - #### setInputStream

          public B setInputStream(InputStream origin)

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

    - #### setOrigin

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

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

    - #### setOutputStream

          public B setOutputStream(OutputStream origin)

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

    - #### setPath

          public B setPath(Path origin)

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

    - #### setPath

          public B setPath(String origin)

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

    - #### setRandomAccessFile

          public B setRandomAccessFile(IORandomAccessFile origin)

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

    - #### setRandomAccessFile

          public B setRandomAccessFile(RandomAccessFile origin)

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

    - #### setReader

          public B setReader(Reader origin)

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

    - #### setURI

          public B setURI(URI origin)

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

    - #### setWriter

          public B setWriter(Writer origin)

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