Class RenameUtil

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.rolling.helper.RenameUtil
All Implemented Interfaces:
ContextAware

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

    • RENAMING_ERROR_URL

      static String RENAMING_ERROR_URL
  • Constructor Details

    • RenameUtil

      public RenameUtil()
  • Method Details

    • rename

      public void rename(String src, 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

      Boolean areOnDifferentVolumes(File srcFile, 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
    • renameByCopying

      public void renameByCopying(String src, String target) throws RolloverFailure
      Throws:
      RolloverFailure
    • createMissingTargetDirsIfNecessary

      void createMissingTargetDirsIfNecessary(File toFile) throws RolloverFailure
      Throws:
      RolloverFailure
    • toString

      public String toString()
      Overrides:
      toString in class Object