Package org.apache.maven.shared.utils.io
Class Java7Support
- java.lang.Object
-
- org.apache.maven.shared.utils.io.Java7Support
-
public class Java7Support extends java.lang.Object
Java7 feature detection
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.reflect.Method
createSymlink
private static java.lang.reflect.Method
delete
private static java.lang.Object
emptyFileAttributes
private static java.lang.Object
emptyLinkOpts
private static java.lang.reflect.Method
exists
private static boolean
IS_JAVA7
private static java.lang.reflect.Method
isSymbolicLink
private static java.lang.reflect.Method
readSymlink
private static java.lang.reflect.Method
toFile
private static java.lang.reflect.Method
toPath
-
Constructor Summary
Constructors Constructor Description Java7Support()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.File
createSymbolicLink(java.io.File symlink, java.io.File target)
static void
delete(java.io.File file)
Performs a nio deletestatic boolean
exists(java.io.File file)
static boolean
isAtLeastJava7()
static boolean
isJava7()
static boolean
isSymLink(java.io.File file)
static java.io.File
readSymbolicLink(java.io.File symlink)
-
-
-
Field Detail
-
IS_JAVA7
private static final boolean IS_JAVA7
-
isSymbolicLink
private static java.lang.reflect.Method isSymbolicLink
-
delete
private static java.lang.reflect.Method delete
-
toPath
private static java.lang.reflect.Method toPath
-
exists
private static java.lang.reflect.Method exists
-
toFile
private static java.lang.reflect.Method toFile
-
readSymlink
private static java.lang.reflect.Method readSymlink
-
createSymlink
private static java.lang.reflect.Method createSymlink
-
emptyLinkOpts
private static java.lang.Object emptyLinkOpts
-
emptyFileAttributes
private static java.lang.Object emptyFileAttributes
-
-
Method Detail
-
isSymLink
public static boolean isSymLink(@Nonnull java.io.File file)
- Parameters:
file
- The file to check for being a symbolic link.- Returns:
- true if the file is a symlink false otherwise.
-
readSymbolicLink
@Nonnull public static java.io.File readSymbolicLink(@Nonnull java.io.File symlink) throws java.io.IOException
- Parameters:
symlink
- The sym link.- Returns:
- The file.
- Throws:
java.io.IOException
- in case of error.
-
exists
public static boolean exists(@Nonnull java.io.File file) throws java.io.IOException
- Parameters:
file
- The file to check.- Returns:
- true if exist false otherwise.
- Throws:
java.io.IOException
- in case of failure.
-
createSymbolicLink
@Nonnull public static java.io.File createSymbolicLink(@Nonnull java.io.File symlink, @Nonnull java.io.File target) throws java.io.IOException
- Parameters:
symlink
- The link name.target
- The target.- Returns:
- The linked file.
- Throws:
java.io.IOException
- in case of an error.
-
delete
public static void delete(@Nonnull java.io.File file) throws java.io.IOException
Performs a nio delete- Parameters:
file
- the file to delete- Throws:
java.io.IOException
- in case of error.
-
isJava7
public static boolean isJava7()
- Returns:
- true in case of Java 7.
-
isAtLeastJava7
public static boolean isAtLeastJava7()
- Returns:
- true in case of Java7 or greater.
-
-