org.apache.commons.release.plugin

## Class SharedFunctions

- java.lang.Object
- - org.apache.commons.release.plugin.SharedFunctions

-     public final class SharedFunctions
      extends Object

  Shared static functions for all of our Mojos.
  Since:
    1.0
  Author:
    chtompki

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `BUFFER_BYTE_SIZE` I want a buffer that is an array with 1024 elements of bytes.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `private` | `SharedFunctions()` Making the constructor private because the class only contains static methods.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `copyFile(org.apache.maven.plugin.logging.Log log, File fromFile, File toFile)` Copies a `File` from the `fromFile` to the `toFile` and logs the failure using the Maven `Log`.
    `static void` | `initDirectory(org.apache.maven.plugin.logging.Log log, File workingDirectory)` Cleans and then initializes an empty directory that is given by the `workingDirectory` parameter.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### BUFFER_BYTE_SIZE

          public static final int BUFFER_BYTE_SIZE

      I want a buffer that is an array with 1024 elements of bytes. We declare the constant here for the sake of making the code more readable.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SharedFunctions

          private SharedFunctions()

      Making the constructor private because the class only contains static methods.

  - ### Method Detail

    - #### initDirectory

          public static void initDirectory(org.apache.maven.plugin.logging.Log log,
                                           File workingDirectory)
                                    throws org.apache.maven.plugin.MojoExecutionException

      Cleans and then initializes an empty directory that is given by the `workingDirectory` parameter.
      Parameters:
        `log` - is the Maven log for output logging, particularly in regards to error management.
        `workingDirectory` - is a `File` that represents the directory to first attempt to delete then create.
      Throws:
        `org.apache.maven.plugin.MojoExecutionException` - when an `IOException` or `NullPointerException` is caught for the purpose of bubbling the exception up to Maven properly.

    - #### copyFile

          public static void copyFile(org.apache.maven.plugin.logging.Log log,
                                      File fromFile,
                                      File toFile)
                               throws org.apache.maven.plugin.MojoExecutionException

      Copies a `File` from the `fromFile` to the `toFile` and logs the failure using the Maven `Log`.
      Parameters:
        `log` - the `Log`, the maven logger.
        `fromFile` - the `File` from which to copy.
        `toFile` - the `File` to which to copy into.
      Throws:
        `org.apache.maven.plugin.MojoExecutionException` - if an `IOException` or `NullPointerException` is caught.

Copyright © 2018 The Apache Software Foundation. All rights reserved.