Package org.apache.commons.io.build

# Class AbstractOrigin.FileOrigin

java.lang.Object
org.apache.commons.io.build.AbstractSupplier<File,AbstractOrigin.FileOrigin>
org.apache.commons.io.build.AbstractOrigin<File,AbstractOrigin.FileOrigin>
org.apache.commons.io.build.AbstractOrigin.FileOrigin

All Implemented Interfaces:
  `IOSupplier<File>`

Enclosing class:
  `AbstractOrigin<T,B extends AbstractOrigin<T,B>>`

public static class AbstractOrigin.FileOrigin extends AbstractOrigin<File,AbstractOrigin.FileOrigin>
A `File` origin.

Starting from this origin, you can get a byte array, a file, an input stream, an output stream, a path, a reader, and a writer.

- ## 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.ChannelOrigin, AbstractOrigin.CharSequenceOrigin, AbstractOrigin.FileOrigin, AbstractOrigin.InputStreamOrigin, AbstractOrigin.IORandomAccessFileOrigin, AbstractOrigin.OutputStreamOrigin, AbstractOrigin.PathOrigin, AbstractOrigin.RandomAccessFileOrigin, AbstractOrigin.ReaderOrigin, AbstractOrigin.URIOrigin, AbstractOrigin.WriterOrigin`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FileOrigin(File origin)`
  Constructs a new instance for the given origin.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `byte[]`
  `getByteArray(long position, int length)`
  Gets a portion of this origin as a byte array, if possible.
  `protected Channel`
  `getChannel(OpenOption... options)`
  Gets this origin as a Channel, if possible.
  `File`
  `getFile()`
  Gets this origin as a File, if possible.
  `Path`
  `getPath()`
  Gets this origin as a Path, if possible.

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

  `get, getByteArray, getChannel, getCharSequence, getInputStream, getOutputStream, getRandomAccessFile, getReader, getWriter, 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 Details

  - ### FileOrigin

    public FileOrigin(File origin)
    Constructs a new instance for the given origin.
    Parameters:
      `origin` - The origin, not null.
    Throws:
      `NullPointerException` - if `origin` is `null`.

- ## Method Details

  - ### getByteArray

    public byte[] getByteArray(long position, int length) throws IOException
    Description copied from class: `AbstractOrigin`
    Gets a portion of this origin as a byte array, if possible.
    Overrides:
      `getByteArray` in class `AbstractOrigin<File,AbstractOrigin.FileOrigin>`
    Parameters:
      `position` - the initial index of the range to be copied, inclusive.
      `length` - How many bytes to copy.
    Returns:
      this origin as a byte array, if possible.
    Throws:
      `IOException` - if an I/O error occurs.

  - ### getChannel

    protected Channel getChannel(OpenOption... options) throws IOException
    Description copied from class: `AbstractOrigin`
    Gets this origin as a Channel, if possible.
    Overrides:
      `getChannel` in class `AbstractOrigin<File,AbstractOrigin.FileOrigin>`
    Parameters:
      `options` - Options specifying how a file-based origin is opened, ignored otherwise.
    Returns:
      A new Channel on the origin.
    Throws:
      `IOException` - If an I/O error occurs.
    See Also:
      - `AbstractOrigin.getChannel(Class, OpenOption...)`

  - ### getFile

    public File getFile()
    Gets this origin as a File, if possible.

    No conversion should occur when calling this method.

    Overrides:
      `getFile` in class `AbstractOrigin<File,AbstractOrigin.FileOrigin>`
    Returns:
      this origin as a File, if possible.

  - ### getPath

    public Path getPath()
    Description copied from class: `AbstractOrigin`
    Gets this origin as a Path, if possible.
    Overrides:
      `getPath` in class `AbstractOrigin<File,AbstractOrigin.FileOrigin>`
    Returns:
      this origin as a Path, if possible.