Class FileHelper


  • public class FileHelper
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      FileHelper()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.file.Path atomicFileMoveOrReplace​(java.nio.file.Path sourceFile, java.nio.file.Path targetFile)  
      java.nio.file.Path createNewFile​(java.io.File newFile, java.lang.String posixFileAttributes)  
      java.nio.file.Path createNewFile​(java.nio.file.Path newFile, java.lang.String posixFileAttributes)  
      java.nio.file.Path createNewFile​(java.nio.file.Path newFile, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions)  
      boolean isPosixFileSystem​(java.nio.file.Path path)  
      boolean isWritableDirectory​(java.lang.String path)  
      void writeFileSafely​(java.nio.file.Path targetFile, java.nio.file.Path backupFile, java.nio.file.Path tmpFile, BaseAction<java.io.File,​java.io.IOException> write)  
      void writeFileSafely​(java.nio.file.Path targetFile, BaseAction<java.io.File,​java.io.IOException> operation)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileHelper

        public FileHelper()
    • Method Detail

      • writeFileSafely

        public void writeFileSafely​(java.nio.file.Path targetFile,
                                    BaseAction<java.io.File,​java.io.IOException> operation)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writeFileSafely

        public void writeFileSafely​(java.nio.file.Path targetFile,
                                    java.nio.file.Path backupFile,
                                    java.nio.file.Path tmpFile,
                                    BaseAction<java.io.File,​java.io.IOException> write)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • createNewFile

        public java.nio.file.Path createNewFile​(java.io.File newFile,
                                                java.lang.String posixFileAttributes)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • createNewFile

        public java.nio.file.Path createNewFile​(java.nio.file.Path newFile,
                                                java.lang.String posixFileAttributes)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • createNewFile

        public java.nio.file.Path createNewFile​(java.nio.file.Path newFile,
                                                java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • isPosixFileSystem

        public boolean isPosixFileSystem​(java.nio.file.Path path)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • atomicFileMoveOrReplace

        public java.nio.file.Path atomicFileMoveOrReplace​(java.nio.file.Path sourceFile,
                                                          java.nio.file.Path targetFile)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • isWritableDirectory

        public boolean isWritableDirectory​(java.lang.String path)