public final class FileUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
S_IRGRP |
static int |
S_IROTH |
static int |
S_IRUSR |
static int |
S_IRWXG |
static int |
S_IRWXO |
static int |
S_IRWXU |
static int |
S_IWGRP |
static int |
S_IWOTH |
static int |
S_IWUSR |
static int |
S_IXGRP |
static int |
S_IXOTH |
static int |
S_IXUSR |
Modifier and Type | Method and Description |
---|---|
static FileAttribute<?> |
fileAttributesFromInteger(int perm)
Create NIO file attributes from numerical POSIX permissions.
|
static String |
fileKey(File file)
Return a unique string identifying the given file object.
|
static String |
fileKey(Path path)
Return a unique string identifying the given path object.
|
static String |
fileKey(String path)
Return a unique string identifying the given path string.
|
static Set<PosixFilePermission> |
posixPermissionsFromInteger(int perm)
Create NIO POSIX file permissions from numerical POSIX permissions.
|
static byte[] |
readToByteArray(File file)
Read all the bytes from a file object.
|
static byte[] |
readToByteArray(Path path)
Read all the bytes from a path object.
|
static byte[] |
readToByteArray(String path)
Read all the bytes from a path string.
|
static String |
readToString(File file)
Read a UTF-8 string from a file object.
|
static String |
readToString(Path path)
Read a UTF-8 string from a path object.
|
static String |
readToString(String path)
Read a UTF-8 string from a path string.
|
static boolean |
recursiveDelete(File path)
Recursively delete the given path, stopping on the first error.
|
static void |
writeToFile(File file,
byte[] data)
Write bytes to a file object.
|
static void |
writeToFile(File file,
String data)
Write a UTF-8 string to a file object.
|
static void |
writeToFile(Path path,
byte[] data)
Write bytes to a path object.
|
static void |
writeToFile(Path path,
String data)
Write a UTF-8 string to a path object.
|
static void |
writeToFile(String path,
byte[] data)
Write bytes to a path string.
|
static void |
writeToFile(String path,
String data)
Write a UTF-8 string to a path string.
|
public static final int S_IRWXU
public static final int S_IRUSR
public static final int S_IWUSR
public static final int S_IXUSR
public static final int S_IRWXG
public static final int S_IRGRP
public static final int S_IWGRP
public static final int S_IXGRP
public static final int S_IRWXO
public static final int S_IROTH
public static final int S_IWOTH
public static final int S_IXOTH
public static Set<PosixFilePermission> posixPermissionsFromInteger(int perm)
public static FileAttribute<?> fileAttributesFromInteger(int perm)
public static String fileKey(File file) throws IOException
IOException
public static String fileKey(String path) throws IOException
IOException
public static String fileKey(Path path) throws IOException
IOException
public static void writeToFile(File file, String data) throws IOException
IOException
public static void writeToFile(String path, String data) throws IOException
IOException
public static void writeToFile(Path path, String data) throws IOException
IOException
public static void writeToFile(File file, byte[] data) throws IOException
IOException
public static void writeToFile(String path, byte[] data) throws IOException
IOException
public static void writeToFile(Path path, byte[] data) throws IOException
IOException
public static String readToString(File file) throws IOException
IOException
public static String readToString(String path) throws IOException
IOException
public static String readToString(Path path) throws IOException
IOException
public static byte[] readToByteArray(File file) throws IOException
IOException
public static byte[] readToByteArray(String path) throws IOException
IOException
public static byte[] readToByteArray(Path path) throws IOException
IOException
public static boolean recursiveDelete(File path)
Copyright © 2019. All rights reserved.