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.ObjectA 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 classFileSystem.ForLegacyVmA file system representation for a VM that does not support NIO2.protected static classFileSystem.ForNio2CapableVmA 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 voidcopy(java.io.File source, java.io.File target)Copies a file.private static <T> TdoPrivileged(java.security.PrivilegedAction<T> action)A proxy forjava.security.AccessController#doPrivilegedthat is activated if available.static FileSystemgetInstance()Returns theFileSysteminstance to use.voidlink(java.io.File source, java.io.File target)Links a file as a hard-link.abstract voidmove(java.io.File source, java.io.File target)Moves a file.
-
-
-
Method Detail
-
getInstance
@Enhance("INSTANCE") public static FileSystem getInstance()
Returns theFileSysteminstance to use.- Returns:
- The
FileSysteminstance to use.
-
doPrivileged
@Enhance private static <T> T doPrivileged(java.security.PrivilegedAction<T> action)
A proxy forjava.security.AccessController#doPrivilegedthat 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.IOExceptionCopies a file.- Parameters:
source- The source file.target- The target file.- Throws:
java.io.IOException- If an I/O exception occurs.
-
link
public void link(java.io.File source, java.io.File target) throws java.io.IOExceptionLinks 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:
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.IOExceptionMoves a file.- Parameters:
source- The source file.target- The target file.- Throws:
java.io.IOException- If an I/O exception occurs.
-
-