org.eclipse.aether.spi.io

## Interface FileProcessor

- All Known Implementing Classes:
    DefaultFileProcessor, TestFileProcessor

      public interface FileProcessor

  A utility component to perform file-based operations.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `FileProcessor.ProgressListener` A listener object that is notified for every progress made while copying files.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `copy(File source, File target)` Copies the specified source file to the given target file.
    `long` | `copy(File source, File target, FileProcessor.ProgressListener listener)` Copies the specified source file to the given target file.
    `boolean` | `mkdirs(File directory)` Creates the directory named by the given abstract pathname, including any necessary but nonexistent parent directories.
    `void` | `move(File source, File target)` Moves the specified source file to the given target file.
    `void` | `write(File target, InputStream source)` Writes the given stream to a file.
    `void` | `write(File target, String data)` Writes the given data to a file.

- - ### Method Detail

    - #### mkdirs

          boolean mkdirs(File directory)

      Creates the directory named by the given abstract pathname, including any necessary but nonexistent parent directories. Note that if this operation fails it may have succeeded in creating some of the necessary parent directories.
      Parameters:
        `directory` - The directory to create, may be `null`.
      Returns:
        `true` if and only if the directory was created, along with all necessary parent directories; `false` otherwise

    - #### write

          void write(File target,
                   String data)
                     throws IOException

      Writes the given data to a file. UTF-8 is assumed as encoding for the data. Creates the necessary directories for the target file. In case of an error, the created directories will be left on the file system.
      Parameters:
        `target` - The file to write to, must not be `null`. This file will be overwritten.
        `data` - The data to write, may be `null`.
      Throws:
        `IOException` - If an I/O error occurs.

    - #### write

          void write(File target,
                   InputStream source)
                     throws IOException

      Writes the given stream to a file. Creates the necessary directories for the target file. In case of an error, the created directories will be left on the file system.
      Parameters:
        `target` - The file to write to, must not be `null`. This file will be overwritten.
        `source` - The stream to write to the file, must not be `null`.
      Throws:
        `IOException` - If an I/O error occurs.

    - #### move

          void move(File source,
                  File target)
                    throws IOException

      Moves the specified source file to the given target file. If the target file already exists, it is overwritten. Creates the necessary directories for the target file. In case of an error, the created directories will be left on the file system.
      Parameters:
        `source` - The file to move from, must not be `null`.
        `target` - The file to move to, must not be `null`.
      Throws:
        `IOException` - If an I/O error occurs.

    - #### copy

          void copy(File source,
                  File target)
                    throws IOException

      Copies the specified source file to the given target file. Creates the necessary directories for the target file. In case of an error, the created directories will be left on the file system.
      Parameters:
        `source` - The file to copy from, must not be `null`.
        `target` - The file to copy to, must not be `null`.
      Throws:
        `IOException` - If an I/O error occurs.

    - #### copy

          long copy(File source,
                  File target,
                  FileProcessor.ProgressListener listener)
                    throws IOException

      Copies the specified source file to the given target file. Creates the necessary directories for the target file. In case of an error, the created directories will be left on the file system.
      Parameters:
        `source` - The file to copy from, must not be `null`.
        `target` - The file to copy to, must not be `null`.
        `listener` - The listener to notify about the copy progress, may be `null`.
      Returns:
        The number of copied bytes.
      Throws:
        `IOException` - If an I/O error occurs.

Copyright © 2010-2014 The Eclipse Foundation. All Rights Reserved.