Class RenameUtil

  • All Implemented Interfaces:
    ContextAware

    public class RenameUtil
    extends ContextAwareBase
    Utility class to help solving problems encountered while renaming files.
    • Field Detail

      • RENAMING_ERROR_URL

        static java.lang.String RENAMING_ERROR_URL
    • Constructor Detail

      • RenameUtil

        public RenameUtil()
    • Method Detail

      • rename

        public void rename​(java.lang.String src,
                           java.lang.String target)
                    throws RolloverFailure
        A relatively robust file renaming method which in case of failure due to src and target being on different volumes, falls back onto renaming by copying.
        Parameters:
        src -
        target -
        Throws:
        RolloverFailure
      • areOnDifferentVolumes

        java.lang.Boolean areOnDifferentVolumes​(java.io.File srcFile,
                                                java.io.File targetFile)
                                         throws RolloverFailure
        Attempts to determine whether both files are on different volumes. Returns true if we could determine that the files are on different volumes. Returns false otherwise or if an error occurred while doing the check.
        Parameters:
        srcFile -
        targetFile -
        Returns:
        true if on different volumes, false otherwise or if an error occurred
        Throws:
        RolloverFailure
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object