Class NioFiles


  • public class NioFiles
    extends java.lang.Object
    Encapsulates use of java7 features, exposing mostly backward compatible types
    • Constructor Summary

      Constructors 
      Constructor Description
      NioFiles()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void chmod​(java.io.File file, int mode)  
      static java.io.File copy​(java.io.File source, java.io.File target)  
      static java.io.File createSymbolicLink​(java.io.File symlink, java.io.File target)  
      static boolean deleteIfExists​(java.io.File file)  
      static long getLastModified​(java.io.File file)  
      private static java.util.Set<java.nio.file.attribute.PosixFilePermission> getPermissions​(int mode)  
      static boolean isSymbolicLink​(java.io.File file)  
      static java.io.File readSymbolicLink​(java.io.File symlink)
      Reads the target of the symbolic link
      • Methods inherited from class java.lang.Object

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

      • NioFiles

        public NioFiles()
    • Method Detail

      • isSymbolicLink

        public static boolean isSymbolicLink​(java.io.File file)
      • chmod

        public static void chmod​(java.io.File file,
                                 int mode)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • getPermissions

        private static java.util.Set<java.nio.file.attribute.PosixFilePermission> getPermissions​(int mode)
      • getLastModified

        public static long getLastModified​(java.io.File file)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • readSymbolicLink

        public static java.io.File readSymbolicLink​(java.io.File symlink)
                                             throws java.io.IOException
        Reads the target of the symbolic link
        Parameters:
        symlink - A file that is a symlink
        Returns:
        A file that is the target of the symlink
        Throws:
        java.io.IOException - io issue
      • createSymbolicLink

        public static java.io.File createSymbolicLink​(java.io.File symlink,
                                                      java.io.File target)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • deleteIfExists

        public static boolean deleteIfExists​(java.io.File file)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.File copy​(java.io.File source,
                                        java.io.File target)
                                 throws java.io.IOException
        Throws:
        java.io.IOException