| Modifier and Type | Class and Description |
|---|---|
| public static interface |
| Modifier and Type | Field and Description |
|---|---|
| private static Method | attachmentMethod
The attachment() method. |
| private static Method | cleanerCleanMethod
The Cleaner.clean() method. |
| private static String | currDirPath
The current directory path (only reads the current directory once, the first time this field is accessed, so will not reflect subsequent changes to the current directory). |
| private static Method | directByteBufferCleanerMethod
The DirectByteBuffer.cleaner() method. |
| private static AtomicBoolean | initialized
True if class' static fields have been initialized. |
| public static final int | MAX_BUFFER_SIZE
The maximum size of a file buffer array. |
| private static Object | theUnsafe
The Unsafe object. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | |
| public static boolean | |
| public static boolean | Returns: true if the file exists, is a directory, and can be read.A file)File.Check if a |
| public static boolean | Returns: true if the file exists, is a directory, and can be read.A path)Path.Check if a |
| public static boolean | Returns: true if the file exists, is a regular file, and can be read.A file)File.Check if a |
| public static boolean | Returns: true if the file exists, is a regular file, and can be read.A path)Path.Check if a |
| public static void | checkCanReadAndIsDir(final File
A file)File.Check if a |
| public static void | checkCanReadAndIsFile(final File
A file)File.Check if a |
| public static void | checkCanReadAndIsFile(final Path
A path)Path.Check if a |
| public static boolean | Returns: True if the byteBuffer was closed/unmapped.The byteBuffer, final ReflectionUtils reflectionUtils, final LogNode ByteBuffer to close/unmap.The log. log)Close a |
| private static boolean | Returns: true if successfulthe byte buffer byteBuffer, final LogNode the log log)Close a direct byte buffer (run in doPrivileged). |
| public static FileUtils. | |
| public static String | Returns: The current directory, as a stringGet the current directory (only looks at the current directory the first time it is called, then caches this value for future reads). |
| public static String | Returns: the parent dir paththe path path, final char the separator separator)Get the parent dir path. |
| public static String | |
| public static boolean | Returns: true if path has a ".class" extension, ignoring case.A file path. path)Check if the path ends with a ".class" extension, ignoring case. |
| public static boolean | |
| public static boolean | |
| private static void | lookupCleanMethodPrivileged()
Get the clean() method, attachment() method, and theUnsafe field, called inside doPrivileged. |
| public static BasicFileAttributes | |
| public static String | Returns: The sanitized path.The path to sanitize. path, final boolean If true, remove any '/' character(s) from the beginning of the returned path. removeInitialSlash, final boolean If true, remove any '/' character(s) from the end of the returned path. removeFinalSlash)Sanitize relative paths against "zip slip" vulnerability, by removing path segments if ".." is found in the URL, but without allowing navigation above the path hierarchy root. |
| attachmentMethod | back to summary |
|---|---|
| private static Method attachmentMethod The attachment() method. | |
| cleanerCleanMethod | back to summary |
|---|---|
| private static Method cleanerCleanMethod The Cleaner.clean() method. | |
| currDirPath | back to summary |
|---|---|
| private static String currDirPath The current directory path (only reads the current directory once, the first time this field is accessed, so will not reflect subsequent changes to the current directory). | |
| directByteBufferCleanerMethod | back to summary |
|---|---|
| private static Method directByteBufferCleanerMethod The DirectByteBuffer.cleaner() method. | |
| initialized | back to summary |
|---|---|
| private static AtomicBoolean initialized True if class' static fields have been initialized. | |
| MAX_BUFFER_SIZE | back to summary |
|---|---|
| public static final int MAX_BUFFER_SIZE The maximum size of a file buffer array. Eight bytes smaller than | |
| theUnsafe | back to summary |
|---|---|
| private static Object theUnsafe The Unsafe object. | |
| FileUtils | back to summary |
|---|---|
| private FileUtils() Constructor. | |
| canRead | back to summary |
|---|---|
| public static boolean canRead(final File file) Check if a | |
| canRead | back to summary |
|---|---|
| public static boolean canRead(final Path path) Check if a | |
| canReadAndIsDir | back to summary |
|---|---|
| public static boolean canReadAndIsDir(final File file) Check if a | |
| canReadAndIsDir | back to summary |
|---|---|
| public static boolean canReadAndIsDir(final Path path) Check if a | |
| canReadAndIsFile | back to summary |
|---|---|
| public static boolean canReadAndIsFile(final File file) Check if a | |
| canReadAndIsFile | back to summary |
|---|---|
| public static boolean canReadAndIsFile(final Path path) Check if a | |
| checkCanReadAndIsDir | back to summary |
|---|---|
| public static void checkCanReadAndIsDir(final File file) throws IOException Check if a
| |
| checkCanReadAndIsFile | back to summary |
|---|---|
| public static void checkCanReadAndIsFile(final File file) throws IOException Check if a
| |
| checkCanReadAndIsFile | back to summary |
|---|---|
| public static void checkCanReadAndIsFile(final Path path) throws IOException Check if a
| |
| closeDirectByteBuffer | back to summary |
|---|---|
| public static boolean closeDirectByteBuffer(final ByteBuffer byteBuffer, final ReflectionUtils reflectionUtils, final LogNode log) Close a
| |
| closeDirectByteBufferPrivileged | back to summary |
|---|---|
| private static boolean closeDirectByteBufferPrivileged(final ByteBuffer byteBuffer, final LogNode log) Close a direct byte buffer (run in doPrivileged).
| |
| createCachedAttributesGetter | back to summary |
|---|---|
| public static FileUtils. | |
| currDirPath | back to summary |
|---|---|
| public static String currDirPath() Get the current directory (only looks at the current directory the first time it is called, then caches this value for future reads).
| |
| getParentDirPath | back to summary |
|---|---|
| public static String getParentDirPath(final String path, final char separator) Get the parent dir path. | |
| getParentDirPath | back to summary |
|---|---|
| public static String getParentDirPath(final String path) Get the parent dir path. | |
| isClassfile | back to summary |
|---|---|
| public static boolean isClassfile(final String path) Check if the path ends with a ".class" extension, ignoring case.
| |
| isDir | back to summary |
|---|---|
| public static boolean isDir(final Path path) | |
| isFile | back to summary |
|---|---|
| public static boolean isFile(final Path path) | |
| lookupCleanMethodPrivileged | back to summary |
|---|---|
| private static void lookupCleanMethodPrivileged() Get the clean() method, attachment() method, and theUnsafe field, called inside doPrivileged. | |
| readAttributes | back to summary |
|---|---|
| public static BasicFileAttributes readAttributes(final Path path) | |
| sanitizeEntryPath | back to summary |
|---|---|
| public static String sanitizeEntryPath(final String path, final boolean removeInitialSlash, final boolean removeFinalSlash) Sanitize relative paths against "zip slip" vulnerability, by removing path segments if ".." is found in the URL, but without allowing navigation above the path hierarchy root. Treats each "!" character as a new path hierarchy root. Also removes "." and empty path segments ("//"). | |
| Modifier and Type | Method and Description |
|---|---|
| public BasicFileAttributes |
| get | back to summary |
|---|---|
| public BasicFileAttributes get(Path path) | |