Class FileSystem

  • Direct Known Subclasses:
    FileSystem.ForLegacyVm, FileSystem.ForNio2CapableVm

    public abstract class FileSystem
    extends java.lang.Object
    A dispatcher to interact with the file system. If NIO2 is available, the API is used. Otherwise, byte streams are used.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static FileSystem INSTANCE
      The file system accessor to use.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileSystem()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void copy​(java.io.File source, java.io.File target)
      Copies a file.
      private static <T> T doPrivileged​(java.security.PrivilegedAction<T> action)
      A proxy for java.security.AccessController#doPrivileged that is activated if available.
      abstract void move​(java.io.File source, java.io.File target)
      Moves a file.
      • Methods inherited from class java.lang.Object

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

      • INSTANCE

        public static final FileSystem INSTANCE
        The file system accessor to use.
    • Constructor Detail

      • FileSystem

        public FileSystem()
    • Method Detail

      • doPrivileged

        @Enhance
        private static <T> T doPrivileged​(java.security.PrivilegedAction<T> action)
        A proxy for java.security.AccessController#doPrivileged that is activated if available.
        Type Parameters:
        T - The type of the action's resolved value.
        Parameters:
        action - The action to execute from a privileged context.
        Returns:
        The action's resolved value.
      • copy

        public abstract void copy​(java.io.File source,
                                  java.io.File target)
                           throws java.io.IOException
        Copies a file.
        Parameters:
        source - The source file.
        target - The target file.
        Throws:
        java.io.IOException - If an I/O exception occurs.
      • move

        public abstract void move​(java.io.File source,
                                  java.io.File target)
                           throws java.io.IOException
        Moves a file.
        Parameters:
        source - The source file.
        target - The target file.
        Throws:
        java.io.IOException - If an I/O exception occurs.