Class FileSystem

java.lang.Object
net.bytebuddy.utility.FileSystem
Direct Known Subclasses:
FileSystem.ForLegacyVm, FileSystem.ForNio2CapableVm

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

    • FileSystem

      public FileSystem()
  • Method Details

    • getInstance

      @Enhance("INSTANCE") public static FileSystem getInstance()
      Returns the FileSystem instance to use.
      Returns:
      The FileSystem instance to use.
    • doPrivileged

      @Enhance private static <T> T doPrivileged(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(File source, File target) throws IOException
      Copies a file.
      Parameters:
      source - The source file.
      target - The target file.
      Throws:
      IOException - If an I/O exception occurs.
    • link

      public void link(File source, File target) throws IOException
      Links a file as a hard-link. If linking is not supported, a copy is made.
      Parameters:
      source - The source file.
      target - The target file.
      Throws:
      IOException - If an I/O exception occurs.
    • move

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