org.apache.commons.io.build

## Class AbstractOrigin.CharSequenceOrigin

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

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

      public static class AbstractOrigin.CharSequenceOrigin
      extends AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>

  A `CharSequence` origin.

- - ### 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
    `CharSequenceOrigin(CharSequence origin)` Constructs a new instance for the given origin.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getByteArray()` Gets this origin as a byte array, if possible.
    `CharSequence` | `getCharSequence(Charset charset)` Gets this origin as a byte array, if possible.
    `InputStream` | `getInputStream(OpenOption... options)` Gets this origin as an InputStream, if possible.
    `Reader` | `getReader(Charset charset)` Gets a new Reader on the origin, buffered by default.
    `long` | `size()` Gets the size of the origin, if possible.

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

      `get, getByteArray, getFile, getOutputStream, getPath, getRandomAccessFile, getWriter, 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

    - #### CharSequenceOrigin

          public CharSequenceOrigin(CharSequence origin)

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

  - ### Method Detail

    - #### getByteArray

          public byte[] getByteArray()

      Description copied from class: `AbstractOrigin`
      Gets this origin as a byte array, if possible.
      Overrides:
        `getByteArray` in class `AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>`
      Returns:
        this origin as a byte array, if possible.

    - #### getCharSequence

          public CharSequence getCharSequence(Charset charset)

      Gets this origin as a byte array, if possible.

      The `charset` parameter is ignored since a `CharSequence` does not need a `Charset` to be read.

      Overrides:
        `getCharSequence` in class `AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>`
      Parameters:
        `charset` - The charset to use if conversion from bytes is needed.
      Returns:
        this origin as a byte array, if possible.

    - #### getInputStream

          public InputStream getInputStream(OpenOption... options)
                                     throws IOException

      Gets this origin as an InputStream, if possible.

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

      Overrides:
        `getInputStream` in class `AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>`
      Parameters:
        `options` - options specifying how the file is opened
      Returns:
        this origin as an InputStream, if possible.
      Throws:
        `IOException` - if an I/O error occurs.

    - #### getReader

          public Reader getReader(Charset charset)
                           throws IOException

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

      The `charset` parameter is ignored since a `CharSequence` does not need a `Charset` to be read.

      Overrides:
        `getReader` in class `AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>`
      Parameters:
        `charset` - the charset to use for decoding, null maps to the default Charset.
      Returns:
        a new Reader on the origin.
      Throws:
        `IOException` - if an I/O error occurs opening the file.

    - #### size

          public long size()
                    throws IOException

      Description copied from class: `AbstractOrigin`
      Gets the size of the origin, if possible.
      Overrides:
        `size` in class `AbstractOrigin<CharSequence,AbstractOrigin.CharSequenceOrigin>`
      Returns:
        the size of the origin in bytes or characters.
      Throws:
        `IOException` - if an I/O error occurs.