jaulib v1.3.0
Jau Support Library (C++, Java, ..)
|
Platform agnostic representation of POSIX ::lstat() and ::stat() for a given pathname. More...
Classes | |
class | Field |
Public Member Functions | |
FileStats () | |
Instantiate an empty file_stats with fmode_t::not_existing set. More... | |
boolean | equals (final Object other) |
FileStats (final String path) | |
Instantiates a file_stats for the given path . More... | |
FileStats (final DirItem item) | |
Instantiates a file_stats for the given dir_item. More... | |
FileStats (final int fd) | |
Instantiates a file_stats for the given fd file descriptor. More... | |
DirItem | item () |
Returns the dir_item. More... | |
String | path () |
Returns the unix path representation. More... | |
String | link_target_path () |
Returns the stored link-target path this symbolic-link points to if instance is a symbolic-link, otherwise nullptr. More... | |
FileStats | link_target () |
Returns the link-target this symbolic-link points to if instance is a symbolic-link, otherwise nullptr. More... | |
FileStats | final_target (final long link_count[]) |
Returns the final target element, either a pointer to this instance if not a symbolic-link or the final link-target a symbolic-link (chain) points to. More... | |
boolean | has (final Field.Type bit) |
Returns true if the given field_t fields were retrieved, otherwise false. More... | |
Field | fields () |
Returns the retrieved field_t fields. More... | |
FMode | mode () |
Returns the FMode, file type and mode. More... | |
FMode | prot_mode () |
Returns the POSIX protection bit portion of fmode_t, i.e. More... | |
FMode | type_mode () |
Returns the type bit portion of fmode_t, i.e. More... | |
int | fd () |
Returns the file descriptor if has_fd(), otherwise -1 for no file descriptor. More... | |
int | uid () |
Returns the user id, owning the element. More... | |
int | gid () |
Returns the group id, owning the element. More... | |
long | size () |
Returns the size in bytes of this element if is_file(), otherwise zero. More... | |
Instant | btime () |
Returns the birth time of this element since Unix Epoch, i.e. More... | |
Instant | atime () |
Returns the last access time of this element since Unix Epoch. More... | |
Instant | ctime () |
Returns the last status change time of this element since Unix Epoch. More... | |
Instant | mtime () |
Returns the last modification time of this element since Unix Epoch. More... | |
int | errno_res () |
Returns the errno value occurred to produce this instance, or zero for no error. More... | |
boolean | ok () |
Returns true if no error occurred. More... | |
boolean | has_fd () |
Returns true if entity has a file descriptor. More... | |
boolean | is_socket () |
Returns true if entity is a socket, might be in combination with is_link(). More... | |
boolean | is_block () |
Returns true if entity is a block device, might be in combination with is_link(). More... | |
boolean | is_char () |
Returns true if entity is a character device, might be in combination with is_link(). More... | |
boolean | is_fifo () |
Returns true if entity is a fifo/pipe, might be in combination with is_link(). More... | |
boolean | is_dir () |
Returns true if entity is a directory, might be in combination with is_link(). More... | |
boolean | is_file () |
Returns true if entity is a file, might be in combination with is_link(). More... | |
boolean | is_link () |
Returns true if entity is a symbolic link, might be in combination with is_file(), is_dir(), is_fifo(), is_char(), is_block(), is_socket(). More... | |
boolean | has_access () |
Returns true if entity gives no access to user, exclusive bit. More... | |
boolean | exists () |
Returns true if entity does not exist, exclusive bit. More... | |
String | toString () |
Platform agnostic representation of POSIX ::lstat() and ::stat() for a given pathname.
Implementation follows the symbolic link, i.e. first opens the given pathname with ::lstat() and if identifying as a symbolic link opens it via ::stat() to retrieve the actual properties like size, time and ownership.
Implementation supports named file descriptor, see is_fd().
On GNU/Linux
implementation uses ::statx().
Definition at line 41 of file FileStats.java.
org.jau.fs.FileStats.FileStats | ( | ) |
Instantiate an empty file_stats with fmode_t::not_existing set.
Definition at line 123 of file FileStats.java.
org.jau.fs.FileStats.FileStats | ( | final String | path | ) |
Instantiates a file_stats for the given path
.
The dir_item will be constructed without parent_dir
path | the path to produce stats for |
Definition at line 177 of file FileStats.java.
org.jau.fs.FileStats.FileStats | ( | final DirItem | item | ) |
Instantiates a file_stats for the given dir_item.
item | the dir_item to produce stats for |
Definition at line 186 of file FileStats.java.
org.jau.fs.FileStats.FileStats | ( | final int | fd | ) |
Instantiates a file_stats for the given fd
file descriptor.
fd | file descriptor of an opened file |
Definition at line 195 of file FileStats.java.
Instant org.jau.fs.FileStats.atime | ( | ) |
Returns the last access time of this element since Unix Epoch.
Definition at line 346 of file FileStats.java.
Instant org.jau.fs.FileStats.btime | ( | ) |
Returns the birth time of this element since Unix Epoch, i.e.
its creation time.
Definition at line 344 of file FileStats.java.
Instant org.jau.fs.FileStats.ctime | ( | ) |
Returns the last status change time of this element since Unix Epoch.
Definition at line 348 of file FileStats.java.
boolean org.jau.fs.FileStats.equals | ( | final Object | other | ) |
Definition at line 145 of file FileStats.java.
int org.jau.fs.FileStats.errno_res | ( | ) |
Returns the errno
value occurred to produce this instance, or zero for no error.
Definition at line 353 of file FileStats.java.
boolean org.jau.fs.FileStats.exists | ( | ) |
Returns true if entity does not exist, exclusive bit.
Definition at line 395 of file FileStats.java.
int org.jau.fs.FileStats.fd | ( | ) |
Returns the file descriptor if has_fd(), otherwise -1 for no file descriptor.
Definition at line 328 of file FileStats.java.
Field org.jau.fs.FileStats.fields | ( | ) |
Returns the retrieved field_t fields.
Definition at line 312 of file FileStats.java.
FileStats org.jau.fs.FileStats.final_target | ( | final long | link_count[] | ) |
Returns the final target element, either a pointer to this instance if not a symbolic-link or the final link-target a symbolic-link (chain) points to.
link_count | optional size_t pointer to store the number of symbolic links leading to the final target, excluding the final instance. 0 indicates no symbolic-link; |
Definition at line 293 of file FileStats.java.
int org.jau.fs.FileStats.gid | ( | ) |
Returns the group id, owning the element.
Definition at line 334 of file FileStats.java.
boolean org.jau.fs.FileStats.has | ( | final Field.Type | bit | ) |
Returns true if the given field_t fields were retrieved, otherwise false.
Definition at line 309 of file FileStats.java.
boolean org.jau.fs.FileStats.has_access | ( | ) |
Returns true if entity gives no access to user, exclusive bit.
Definition at line 392 of file FileStats.java.
boolean org.jau.fs.FileStats.has_fd | ( | ) |
Returns true if entity has a file descriptor.
Detected named file descriptors are (d
stands for integer)
/dev/fd/d
(GNU/Linux, FreeBSD, ..)/proc/self/fd/d
(GNU/Linux)Definition at line 368 of file FileStats.java.
boolean org.jau.fs.FileStats.is_block | ( | ) |
Returns true if entity is a block device, might be in combination with is_link().
Definition at line 374 of file FileStats.java.
boolean org.jau.fs.FileStats.is_char | ( | ) |
Returns true if entity is a character device, might be in combination with is_link().
Definition at line 377 of file FileStats.java.
boolean org.jau.fs.FileStats.is_dir | ( | ) |
Returns true if entity is a directory, might be in combination with is_link().
Definition at line 383 of file FileStats.java.
boolean org.jau.fs.FileStats.is_fifo | ( | ) |
Returns true if entity is a fifo/pipe, might be in combination with is_link().
Definition at line 380 of file FileStats.java.
boolean org.jau.fs.FileStats.is_file | ( | ) |
Returns true if entity is a file, might be in combination with is_link().
Definition at line 386 of file FileStats.java.
boolean org.jau.fs.FileStats.is_link | ( | ) |
Returns true if entity is a symbolic link, might be in combination with is_file(), is_dir(), is_fifo(), is_char(), is_block(), is_socket().
Definition at line 389 of file FileStats.java.
boolean org.jau.fs.FileStats.is_socket | ( | ) |
Returns true if entity is a socket, might be in combination with is_link().
Definition at line 371 of file FileStats.java.
DirItem org.jau.fs.FileStats.item | ( | ) |
Returns the dir_item.
In case this instance is created by following a symbolic link instance, it represents the resolved path relative to the used symbolic link's dirname.
Definition at line 250 of file FileStats.java.
FileStats org.jau.fs.FileStats.link_target | ( | ) |
Returns the link-target this symbolic-link points to if instance is a symbolic-link, otherwise nullptr.
nullptr is also returned for an erroneous symbolic-links, i.e. non-existing link-targets or recursive loop-errors.
Definition at line 281 of file FileStats.java.
String org.jau.fs.FileStats.link_target_path | ( | ) |
Returns the stored link-target path this symbolic-link points to if instance is a symbolic-link, otherwise nullptr.
Definition at line 270 of file FileStats.java.
FMode org.jau.fs.FileStats.mode | ( | ) |
Returns the FMode, file type and mode.
Definition at line 315 of file FileStats.java.
Instant org.jau.fs.FileStats.mtime | ( | ) |
Returns the last modification time of this element since Unix Epoch.
Definition at line 350 of file FileStats.java.
boolean org.jau.fs.FileStats.ok | ( | ) |
Returns true if no error occurred.
Definition at line 356 of file FileStats.java.
String org.jau.fs.FileStats.path | ( | ) |
Returns the unix path representation.
In case this instance is created by following a symbolic link instance, it represents the resolved path relative to the used symbolic link's dirname.
Definition at line 261 of file FileStats.java.
FMode org.jau.fs.FileStats.prot_mode | ( | ) |
Returns the POSIX protection bit portion of fmode_t, i.e.
mode() & FMode.Bit#protection_mask
.
Definition at line 318 of file FileStats.java.
long org.jau.fs.FileStats.size | ( | ) |
Returns the size in bytes of this element if is_file(), otherwise zero.
If the element also is_link(), the linked target size is returned.
Definition at line 341 of file FileStats.java.
String org.jau.fs.FileStats.toString | ( | ) |
FMode org.jau.fs.FileStats.type_mode | ( | ) |
Returns the type bit portion of fmode_t, i.e.
mode() & fmode_t::type_mask.
Definition at line 321 of file FileStats.java.
int org.jau.fs.FileStats.uid | ( | ) |
Returns the user id, owning the element.
Definition at line 331 of file FileStats.java.