Package net.bytebuddy.utility
Class FileSystem
- java.lang.Object
-
- net.bytebuddy.utility.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
FileSystem.ForLegacyVm
A file system representation for a VM that does not support NIO2.protected static class
FileSystem.ForNio2CapableVm
A file system representation for a VM that does support NIO2.
-
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 forjava.security.AccessController#doPrivileged
that is activated if available.static FileSystem
getInstance()
Returns theFileSystem
instance to use.abstract void
move(java.io.File source, java.io.File target)
Moves a file.
-
-
-
Method Detail
-
getInstance
@Enhance("INSTANCE") public static FileSystem getInstance()
Returns theFileSystem
instance to use.- Returns:
- The
FileSystem
instance to use.
-
doPrivileged
@Enhance private static <T> T doPrivileged(java.security.PrivilegedAction<T> action)
A proxy forjava.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.
-
-