| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| public static final String | |
| public static final int | DEFAULT_COPY_SIZE
Size of preferred work buffer when reading / writing data to / from streams |
| public static final String | |
| public static final CopyOption[] | |
| public static final FileAttribute | |
| public static final LinkOption[] | |
| public static final OpenOption[] | |
| public static final String | EOL
The local O/S line separator |
| private static final byte[] | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | |
| private static final LinkOption[] | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final String | |
| public static final List | |
| public static final Set | WRITEABLE_OPEN_OPTIONS
A |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static String | |
| public static Path | Returns: the built paththe root path root, FileSystem the filesystem fs, List<String> the parts of the path to build namesList)Build a path from the list of path parts |
| public static Path | Returns: the built paththe filesystem for the path fs, List<String> the names list namesList)Build a relative path on the filesystem fs from the path parts in the namesList |
| public static Boolean | checkFileExists(Path
The path, LinkOption... Path to be testedThe options)LinkOptions to useChecks if a file exists - Note: according to the Java tutorial - Checking a File or Directory: The methods in the Path class are syntactic, meaning that they operate on the Path instance. |
| public static Boolean | Returns: true if the file exists with the symlink semantics, false if it doesn't exist, null if symlinks were found, or it is unknown if whether the file existsthe path to check path, boolean whether to follow symlinks neverFollowSymlinks)Checks that a file exists with or without following any symlinks. |
| public static Path | |
| public static IOException | Returns: The firstIOException that occurred during closing of a resource - null
if not exception. If more than one exception occurred, they are added as suppressed exceptions
to the first oneThe closeables)Closeables to closeCloses a bunch of resources suppressing any |
| public static IOException | Returns: The thrownIOException when close() was called - null if no exception was
thrown (or no resource to close to begin with)The resource to close - ignored if c)nullCloses the specified |
| public static IOException | Returns: The firstIOException that occurred during closing of a resource - null
if not exception. If more than one exception occurred, they are added as suppressed exceptions
to the first oneThe closeables)Closeables to closeCloses a bunch of resources suppressing any |
| public static long | |
| public static long | |
| public static Path | Returns: The same input path if it is a directoryThe path, LinkOption... Path to checkThe options)LinkOptions to use when checking if path is a directory
|
| public static boolean | Returns: true if the link options are null/empty or do not contain
LinkOption#NOFOLLOW_LINKS, false otherwise (i.e., the array is not empty and
contains the special value)The options)LinkOptions - OK if null/empty
|
| public static byte[] | Returns: The local platform line separator bytes as UTF-8Note each call returns a new instance in order to avoid inadvertent changes in shared objects
|
| public static String | Returns: Owner of the file or null if unsupportedNote for Windows it strips any prepended domain or group name The path, LinkOption... PathThe options)LinkOptions to use when querying the ownerGet file owner. |
| public static Path | Returns: the extracted paththe path to extract parts of path, int the number of parts to extract partsToExtract)Extracts the first n parts of the path. |
| public static LinkOption[] | |
| public static Set | getPermissions(Path
The path, LinkOption... PathThe options)LinkOptions to use when querying the permissionsIf the "posix" view is supported, then it returns
|
| public static Set | Returns: ASet of PosixFilePermissions based on whether the file is
readable/writable/executable. If so, then all the relevant permissions are set (i.e., owner,
group and others)The f)File to be checked
|
| public static boolean | |
| public static boolean | |
| public static int | Returns: actual length read; may be less than requested if EOF was reachedwhere to read input from input, byte[] destination buffer)Read as many bytes as possible until EOF or achieved required length |
| public static int | Returns: actual length read; may be less than requested if EOF was reachedwhere to read input from input, byte[] destination buffer, int initial offset into buffer offset, int length to read - ignored if non-positive length)Read as many bytes as possible until EOF or achieved required length |
| public static List | Returns: TheList of lines in the same order as it was readThe url)URL to read fromReads all lines until no more available |
| public static List | Returns: TheList of lines in the same order as it was readThe stream)InputStream - Note: assumed to contain UTF-8 encoded dataReads all lines until no more available |
| public static List | |
| public static List | Returns: TheList of lines in the same order as it was readThe reader)BufferedReader to read all linesReads all lines until no more available |
| public static List | Returns: TheList of lines in the same order as it was readThe reader, int BufferedReader to read all linesA hint as to the expected number of lines - non-positive means unknown - in which case some
initial default value will be used to initialize the list used to accumulate the lines. lineCountHint)Reads all lines until no more available |
| public static void | readFully(InputStream
where to read input from input, byte[] destination buffer)Read the requested number of bytes or fail if there are not enough left. |
| public static void | readFully(InputStream
where to read input from input, byte[] destination buffer, int initial offset into buffer offset, int length to read, must be ≥ 0 length)Read the requested number of bytes or fail if there are not enough left. |
| public static Path | Returns: the sanitized paththe path to sanitize toSanitize)Remove any extra directory ups from the Path |
| private static List | |
| public static void | setPermissions(Path
The path, Set<PosixFilePermission> PathThe perms)Set of PosixFilePermissionsIf the "posix" view is supported, then it invokes |
| public static void | setPermissionsToFile(File
The f, Collection<PosixFilePermission> FileA perms)Collection of PosixFilePermissions to set on itNote the file is set to readable/writable/executable not only by the owner if any of relevant the owner/group/others permission is set
|
| public static byte[] | |
| public static PosixFilePermission | validateExcludedPermissions(Collection<PosixFilePermission>
The current perms, Collection<PosixFilePermission> PosixFilePermissions - ignored if null/emptyThe permissions not allowed to exist - ignored if excluded)null/empty
|
| ACL_VIEW_ATTR | back to summary |
|---|---|
| public static final String ACL_VIEW_ATTR | |
| CREATE_TIME_VIEW_ATTR | back to summary |
|---|---|
| public static final String CREATE_TIME_VIEW_ATTR | |
| DEFAULT_COPY_SIZE | back to summary |
|---|---|
| public static final int DEFAULT_COPY_SIZE Size of preferred work buffer when reading / writing data to / from streams | |
| DIRECTORY_VIEW_ATTR | back to summary |
|---|---|
| public static final String DIRECTORY_VIEW_ATTR | |
| EMPTY_COPY_OPTIONS | back to summary |
|---|---|
| public static final CopyOption[] EMPTY_COPY_OPTIONS | |
| EMPTY_FILE_ATTRIBUTES | back to summary |
|---|---|
| public static final FileAttribute<?>[] EMPTY_FILE_ATTRIBUTES | |
| EMPTY_LINK_OPTIONS | back to summary |
|---|---|
| public static final LinkOption[] EMPTY_LINK_OPTIONS | |
| EMPTY_OPEN_OPTIONS | back to summary |
|---|---|
| public static final OpenOption[] EMPTY_OPEN_OPTIONS | |
| EOL | back to summary |
|---|---|
| public static final String EOL The local O/S line separator | |
| EOL_BYTES | back to summary |
|---|---|
| private static final byte[] EOL_BYTES | |
| EXECUTABLE_VIEW_ATTR | back to summary |
|---|---|
| public static final String EXECUTABLE_VIEW_ATTR | |
| EXTENDED_VIEW_ATTR | back to summary |
|---|---|
| public static final String EXTENDED_VIEW_ATTR | |
| FILEKEY_VIEW_ATTR | back to summary |
|---|---|
| public static final String FILEKEY_VIEW_ATTR | |
| GROUP_VIEW_ATTR | back to summary |
|---|---|
| public static final String GROUP_VIEW_ATTR | |
| GROUPID_VIEW_ATTR | back to summary |
|---|---|
| public static final String GROUPID_VIEW_ATTR | |
| LASTACC_TIME_VIEW_ATTR | back to summary |
|---|---|
| public static final String LASTACC_TIME_VIEW_ATTR | |
| LASTMOD_TIME_VIEW_ATTR | back to summary |
|---|---|
| public static final String LASTMOD_TIME_VIEW_ATTR | |
| NO_FOLLOW_OPTIONS | back to summary |
|---|---|
| private static final LinkOption[] NO_FOLLOW_OPTIONS | |
| NUMLINKS_VIEW_ATTR | back to summary |
|---|---|
| public static final String NUMLINKS_VIEW_ATTR | |
| OTHERFILE_VIEW_ATTR | back to summary |
|---|---|
| public static final String OTHERFILE_VIEW_ATTR | |
| OWNER_VIEW_ATTR | back to summary |
|---|---|
| public static final String OWNER_VIEW_ATTR | |
| PERMISSIONS_VIEW_ATTR | back to summary |
|---|---|
| public static final String PERMISSIONS_VIEW_ATTR | |
| REGFILE_VIEW_ATTR | back to summary |
|---|---|
| public static final String REGFILE_VIEW_ATTR | |
| SIZE_VIEW_ATTR | back to summary |
|---|---|
| public static final String SIZE_VIEW_ATTR | |
| SYMLINK_VIEW_ATTR | back to summary |
|---|---|
| public static final String SYMLINK_VIEW_ATTR | |
| USERID_VIEW_ATTR | back to summary |
|---|---|
| public static final String USERID_VIEW_ATTR | |
| WINDOWS_EXECUTABLE_EXTENSIONS | back to summary |
|---|---|
| public static final List<String> WINDOWS_EXECUTABLE_EXTENSIONS | |
| WRITEABLE_OPEN_OPTIONS | back to summary |
|---|---|
| public static final Set<StandardOpenOption> WRITEABLE_OPEN_OPTIONS A | |
| IoUtils | back to summary |
|---|---|
| private IoUtils() Private Constructor | |
| appendPathComponent | back to summary |
|---|---|
| public static String appendPathComponent(String prefix, String component) | |
| buildPath | back to summary |
|---|---|
| public static Path buildPath(Path root, FileSystem fs, List<String> namesList) Build a path from the list of path parts
| |
| buildRelativePath | back to summary |
|---|---|
| public static Path buildRelativePath(FileSystem fs, List<String> namesList) Build a relative path on the filesystem fs from the path parts in the namesList
| |
| checkFileExists | back to summary |
|---|---|
| public static Boolean checkFileExists(Path path, LinkOption... options) Checks if a file exists - Note: according to the Java tutorial - Checking a File or Directory: The methods in the Path class are syntactic, meaning that they operate on the Path instance. But eventually you must access the file system to verify that a particular Path exists, or does not exist. You can do so with the exists(Path, LinkOption...) and the notExists(Path, LinkOption...) methods. Note that !Files.exists(path) is not equivalent to Files.notExists(path). When you are testing a file's existence, three results are possible: - The file is verified to exist. - The file is verified to not exist. - The file's status is unknown. This result can occur when the program does not have access to the file. If both exists and notExists return false, the existence of the file cannot be verified.
| |
| checkFileExistsAnySymlinks | back to summary |
|---|---|
| public static Boolean checkFileExistsAnySymlinks(Path path, boolean neverFollowSymlinks) Checks that a file exists with or without following any symlinks. | |
| chroot | back to summary |
|---|---|
| public static Path chroot(Path newRoot, Path toSanitize) Chroot a path under the new root | |
| closeQuietly | back to summary |
|---|---|
| public static IOException closeQuietly(Closeable... closeables) Closes a bunch of resources suppressing any
| |
| closeQuietly | back to summary |
|---|---|
| public static IOException closeQuietly(Closeable c) Closes the specified
| |
| closeQuietly | back to summary |
|---|---|
| public static IOException closeQuietly(Collection<? extends Closeable> closeables) Closes a bunch of resources suppressing any
| |
| copy | back to summary |
|---|---|
| public static long copy(InputStream source, OutputStream sink) throws IOException | |
| copy | back to summary |
|---|---|
| public static long copy(InputStream source, OutputStream sink, int bufferSize) throws IOException | |
| ensureDirectory | back to summary |
|---|---|
public static Path ensureDirectory(Path path, LinkOption... options)
| |
| followLinks | back to summary |
|---|---|
public static boolean followLinks(LinkOption... options)
| |
| getEOLBytes | back to summary |
|---|---|
public static byte[] getEOLBytes()
| |
| getFileOwner | back to summary |
|---|---|
| public static String getFileOwner(Path path, LinkOption... options) throws IOException Get file owner.
| |
| getFirstPartsOfPath | back to summary |
|---|---|
| public static Path getFirstPartsOfPath(Path path, int partsToExtract) Extracts the first n parts of the path. For example | |
| getLinkOptions | back to summary |
|---|---|
| public static LinkOption[] getLinkOptions(boolean followLinks) | |
| getPermissions | back to summary |
|---|---|
| public static Set If the "posix" view is supported, then it returns
| |
| getPermissionsFromFile | back to summary |
|---|---|
public static Set
| |
| isExecutable | back to summary |
|---|---|
| public static boolean isExecutable(File f) | |
| isWindowsExecutable | back to summary |
|---|---|
public static boolean isWindowsExecutable(String fileName)
| |
| read | back to summary |
|---|---|
| public static int read(InputStream input, byte[] buffer) throws IOException Read as many bytes as possible until EOF or achieved required length
| |
| read | back to summary |
|---|---|
| public static int read(InputStream input, byte[] buffer, int offset, int length) throws IOException Read as many bytes as possible until EOF or achieved required length
| |
| readAllLines | back to summary |
|---|---|
| public static List Reads all lines until no more available
| |
| readAllLines | back to summary |
|---|---|
| public static List Reads all lines until no more available
| |
| readAllLines | back to summary |
|---|---|
| public static List | |
| readAllLines | back to summary |
|---|---|
| public static List Reads all lines until no more available
| |
| readAllLines | back to summary |
|---|---|
| public static List Reads all lines until no more available
| |
| readFully | back to summary |
|---|---|
| public static void readFully(InputStream input, byte[] buffer) throws IOException Read the requested number of bytes or fail if there are not enough left.
| |
| readFully | back to summary |
|---|---|
| public static void readFully(InputStream input, byte[] buffer, int offset, int length) throws IOException Read the requested number of bytes or fail if there are not enough left.
| |
| removeCdUpAboveRoot | back to summary |
|---|---|
| public static Path removeCdUpAboveRoot(Path toSanitize) Remove any extra directory ups from the Path | |
| removeExtraCdUps | back to summary |
|---|---|
| private static List | |
| setPermissions | back to summary |
|---|---|
| public static void setPermissions(Path path, Set<PosixFilePermission> perms) throws IOException If the "posix" view is supported, then it invokes
| |
| setPermissionsToFile | back to summary |
|---|---|
public static void setPermissionsToFile(File f, Collection<PosixFilePermission> perms)
| |
| toByteArray | back to summary |
|---|---|
| public static byte[] toByteArray(InputStream inStream) throws IOException | |
| validateExcludedPermissions | back to summary |
|---|---|
public static PosixFilePermission validateExcludedPermissions(Collection<PosixFilePermission> perms, Collection<PosixFilePermission> excluded)
| |