| Modifier and Type | Field and Description |
|---|---|
| public static final FileAttribute | NO_ATTRIBUTES
No file attributes. |
| public static final Set | |
| public static final Set | |
| public static final Set | |
| public static final Set |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | |
| public static void | createDirectories(String
the directory name dir)Create the directory and all required parent directories. |
| public static void | createDirectory(String
the directory name directoryName)Create a directory (all required parent directories must already exist). |
| public static boolean | |
| public static String | Returns: the name of the created filethe prefix of the file name (including directory name if
required) prefix, String the suffix suffix, boolean if the file should be stored in the temporary directory inTempDir)Create a new temporary file. |
| public static void | |
| public static void | deleteRecursive(String
the path path, boolean whether errors should be ignored tryOnly)Delete a directory or file and all subdirectories and files. |
| public static boolean | |
| public static String | |
| public static String | |
| public static boolean | Returns: if the file name is absolutethe file name fileName)Check if the file name includes a path. |
| public static boolean | Returns: true if it is a directorythe file or directory name fileName)Check if it is a file or a directory. |
| public static boolean | Returns: true if it is a regular filethe file or directory name fileName)Tests whether a file is a regular file. |
| public static long | Returns: the last modified datethe file name fileName)Get the last modified date of a file. |
| public static Set | Returns: the setthe mode as a string mode)Convert the string representation to a set. |
| public static void | |
| public static void | moveAtomicReplace(String
the old fully qualified file name source, String the new fully qualified file name target)Rename a file if this is allowed, and try to atomically replace an existing file. |
| public static BufferedReader | Returns: the buffered readerthe file name fileName, Charset the charset charset)Create a buffered reader to read from the file. |
| public static List | Returns: the list of fully qualified file namesthe directory path)List the files and directories in the given directory. |
| public static InputStream | Returns: the input streamthe file name fileName)Create an input stream to read from the file. |
| public static OutputStream | Returns: the output streamthe file name fileName, boolean if true, the file will grow, if false, the file will be
truncated first append)Create an output stream to write into the file. |
| public static FileChannel | |
| public static void | readFully(FileChannel
the file channel channel, ByteBuffer the byte buffer dst)Fully read from the file. |
| public static boolean | Returns: true if the call was successfulthe file name fileName)Disable the ability to write. |
| public static long | |
| public static String | Returns: the normalized file namethe file name fileName)Get the canonical file or directory name. |
| public static boolean | |
| public static String | |
| public static void | writeFully(FileChannel
the file channel channel, ByteBuffer the byte buffer src)Fully write to the file. |
| NO_ATTRIBUTES | back to summary |
|---|---|
| public static final FileAttribute<?>[] NO_ATTRIBUTES No file attributes. | |
| R | back to summary |
|---|---|
| public static final Set<? extends OpenOption> R | |
| RW | back to summary |
|---|---|
| public static final Set<? extends OpenOption> RW
| |
| RWD | back to summary |
|---|---|
| public static final Set<? extends OpenOption> RWD
| |
| RWS | back to summary |
|---|---|
| public static final Set<? extends OpenOption> RWS
| |
| FileUtils | back to summary |
|---|---|
| public FileUtils() | |
| canWrite | back to summary |
|---|---|
| public static boolean canWrite(String fileName) Check if the file is writable.
This method is similar to Java 7
| |
| createDirectories | back to summary |
|---|---|
| public static void createDirectories(String dir) Create the directory and all required parent directories.
| |
| createDirectory | back to summary |
|---|---|
| public static void createDirectory(String directoryName) Create a directory (all required parent directories must already exist).
This method is similar to Java 7
| |
| createFile | back to summary |
|---|---|
| public static boolean createFile(String fileName) Create a new file. This method is similar to Java 7
| |
| createTempFile | back to summary |
|---|---|
| public static String createTempFile(String prefix, String suffix, boolean inTempDir) throws IOException Create a new temporary file.
| |
| delete | back to summary |
|---|---|
| public static void delete(String path) Delete a file or directory if it exists.
Directories may only be deleted if they are empty.
This method is similar to Java 7
| |
| deleteRecursive | back to summary |
|---|---|
| public static void deleteRecursive(String path, boolean tryOnly) Delete a directory or file and all subdirectories and files.
| |
| exists | back to summary |
|---|---|
| public static boolean exists(String fileName) Checks if a file exists.
This method is similar to Java 7
| |
| getName | back to summary |
|---|---|
| public static String getName(String path) Get the file or directory name (the last element of the path).
This method is similar to Java 7 | |
| getParent | back to summary |
|---|---|
| public static String getParent(String fileName) Get the parent directory of a file or directory. This method returns null
if there is no parent. This method is similar to Java 7
| |
| isAbsolute | back to summary |
|---|---|
| public static boolean isAbsolute(String fileName) Check if the file name includes a path. This method is similar to Java 7
| |
| isDirectory | back to summary |
|---|---|
| public static boolean isDirectory(String fileName) Check if it is a file or a directory.
| |
| isRegularFile | back to summary |
|---|---|
| public static boolean isRegularFile(String fileName) Tests whether a file is a regular file.
| |
| lastModified | back to summary |
|---|---|
| public static long lastModified(String fileName) Get the last modified date of a file.
This method is similar to Java 7
| |
| modeToOptions | back to summary |
|---|---|
| public static Set Convert the string representation to a set.
| |
| move | back to summary |
|---|---|
| public static void move(String source, String target) Rename a file if this is allowed. This method is similar to Java 7
| |
| moveAtomicReplace | back to summary |
|---|---|
| public static void moveAtomicReplace(String source, String target) Rename a file if this is allowed, and try to atomically replace an
existing file. This method is similar to Java 7
| |
| newBufferedReader | back to summary |
|---|---|
| public static BufferedReader newBufferedReader(String fileName, Charset charset) throws IOException Create a buffered reader to read from the file.
This method is similar to
| |
| newDirectoryStream | back to summary |
|---|---|
| public static List List the files and directories in the given directory.
This method is similar to Java 7
| |
| newInputStream | back to summary |
|---|---|
| public static InputStream newInputStream(String fileName) throws IOException Create an input stream to read from the file.
This method is similar to Java 7
| |
| newOutputStream | back to summary |
|---|---|
| public static OutputStream newOutputStream(String fileName, boolean append) throws IOException Create an output stream to write into the file.
This method is similar to
| |
| open | back to summary |
|---|---|
| public static FileChannel open(String fileName, String mode) throws IOException Open a random access file object.
This method is similar to Java 7
| |
| readFully | back to summary |
|---|---|
| public static void readFully(FileChannel channel, ByteBuffer dst) throws IOException Fully read from the file. This will read all remaining bytes, or throw an EOFException if not successful.
| |
| setReadOnly | back to summary |
|---|---|
| public static boolean setReadOnly(String fileName) Disable the ability to write. The file can still be deleted afterwards.
| |
| size | back to summary |
|---|---|
| public static long size(String fileName) Get the size of a file in bytes
This method is similar to Java 7
| |
| toRealPath | back to summary |
|---|---|
| public static String toRealPath(String fileName) Get the canonical file or directory name. This method is similar to Java
7 | |
| tryDelete | back to summary |
|---|---|
| public static boolean tryDelete(String path) Try to delete a file or directory (ignoring errors).
| |
| unwrap | back to summary |
|---|---|
| public static String unwrap(String fileName) Get the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used). | |
| writeFully | back to summary |
|---|---|
| public static void writeFully(FileChannel channel, ByteBuffer src) throws IOException Fully write to the file. This will write all remaining bytes.
| |