Class AbstractOSFileStore
java.lang.Object
oshi.software.common.AbstractOSFileStore
- All Implemented Interfaces:
OSFileStore
- Direct Known Subclasses:
LinuxOSFileStore, MacOSFileStore, WindowsOSFileStore
Common implementations for OSFileStore
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractOSFileStore(String name, String volume, String label, String mount, String options, String uuid, boolean local, String logicalVolume, String description, String fsType, long freeSpace, long usableSpace, long totalSpace, long freeInodes, long totalInodes) Creates an AbstractOSFileStore with all parameters. -
Method Summary
Modifier and TypeMethodDescriptionDescription of the File System.longUsable / free inodes on the drive.longFree space on the drive.getLabel()Label of the File System.Logical volume of the File System.getMount()Mount point of the File System.getName()Name of the File System.Filesystem options.longTotal / maximum number of inodes of the filesystem.longTotal space/capacity of the drive.getType()Type of the File System (FAT, NTFS, etx2, ext4, etc.)longUsable space on the drive.getUUID()UUID/GUID of the File System.Volume name of the File System.booleanisLocal()Indicates whether this file store is local, providing low-latency access.toString()protected voidupdateFrom(OSFileStore fileStore) Copies mutable attributes from another file store into this one.protected voidupdateSpace(long freeSpace, long usableSpace, long totalSpace) Updates only the space fields (no inodes).protected voidupdateSpaceAndInodes(long freeSpace, long usableSpace, long totalSpace, long freeInodes, long totalInodes) Updates only the space and inode fields.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface OSFileStore
updateAttributes
-
Constructor Details
-
AbstractOSFileStore
protected AbstractOSFileStore(String name, String volume, String label, String mount, String options, String uuid, boolean local, String logicalVolume, String description, String fsType, long freeSpace, long usableSpace, long totalSpace, long freeInodes, long totalInodes) Creates an AbstractOSFileStore with all parameters.- Parameters:
name- the file store namevolume- the volume namelabel- the volume labelmount- the mount pointoptions- the mount optionsuuid- the UUIDlocal- whether this is a local file storelogicalVolume- the logical volumedescription- the descriptionfsType- the filesystem typefreeSpace- free space in bytesusableSpace- usable space in bytestotalSpace- total space in bytesfreeInodes- free inodestotalInodes- total inodes
-
-
Method Details
-
getName
Description copied from interface:OSFileStoreName of the File System. A human-readable label that does not necessarily correspond to a file system path.- Specified by:
getNamein interfaceOSFileStore- Returns:
- The file system name
-
getVolume
Description copied from interface:OSFileStoreVolume name of the File System. Generally a path representing the device (e.g.,/dev/foowhich is being mounted.- Specified by:
getVolumein interfaceOSFileStore- Returns:
- The volume name of the file system
-
getLabel
Description copied from interface:OSFileStoreLabel of the File System. An optional replacement for the name on Windows and Linux.- Specified by:
getLabelin interfaceOSFileStore- Returns:
- The volume label of the file system. Only relevant on Windows and on Linux, if assigned; otherwise defaults to the FileSystem name. On other operating systems is redundant with the name.
-
getMount
Description copied from interface:OSFileStoreMount point of the File System. The directory users will normally use to interface with the file store.- Specified by:
getMountin interfaceOSFileStore- Returns:
- The mountpoint of the file system
-
getOptions
Description copied from interface:OSFileStoreFilesystem options.- Specified by:
getOptionsin interfaceOSFileStore- Returns:
- A comma-deimited string of options
-
getUUID
Description copied from interface:OSFileStoreUUID/GUID of the File System.- Specified by:
getUUIDin interfaceOSFileStore- Returns:
- The file system UUID/GUID
-
isLocal
public boolean isLocal()Description copied from interface:OSFileStoreIndicates whether this file store is local, providing low-latency access.Local file stores are directly attached storage that return immediate results for file operations. This excludes network-mounted file systems (e.g., NFS, CIFS/SMB, AFP) which may have higher latency or require network round-trips.
On macOS, this corresponds to the
MNT_LOCALmount flag. On other platforms, this returnsfalsefor file systems with network types such asnfs,cifs,smbfs, andafs.- Specified by:
isLocalin interfaceOSFileStore- Returns:
trueif the file store is locally attached (not a network drive);falseotherwise
-
getLogicalVolume
Description copied from interface:OSFileStoreLogical volume of the File System. Provides an optional alternative volume identifier for the file system. Only supported on Linux, provides symlink value via '/dev/mapper/' (used with LVM file systems).- Specified by:
getLogicalVolumein interfaceOSFileStore- Returns:
- The logical volume of the file system
-
getDescription
Description copied from interface:OSFileStoreDescription of the File System.- Specified by:
getDescriptionin interfaceOSFileStore- Returns:
- The file system description
-
getType
Description copied from interface:OSFileStoreType of the File System (FAT, NTFS, etx2, ext4, etc.)- Specified by:
getTypein interfaceOSFileStore- Returns:
- The file system type
-
getFreeSpace
public long getFreeSpace()Description copied from interface:OSFileStoreFree space on the drive. This space is unallocated but may require elevated permissions to write.- Specified by:
getFreeSpacein interfaceOSFileStore- Returns:
- Free space on the drive (in bytes)
-
getUsableSpace
public long getUsableSpace()Description copied from interface:OSFileStoreUsable space on the drive. This is space available to unprivileged users.- Specified by:
getUsableSpacein interfaceOSFileStore- Returns:
- Usable space on the drive (in bytes)
-
getTotalSpace
public long getTotalSpace()Description copied from interface:OSFileStoreTotal space/capacity of the drive.- Specified by:
getTotalSpacein interfaceOSFileStore- Returns:
- Total capacity of the drive (in bytes)
-
getFreeInodes
public long getFreeInodes()Description copied from interface:OSFileStoreUsable / free inodes on the drive. Not applicable on Windows.- Specified by:
getFreeInodesin interfaceOSFileStore- Returns:
- Usable / free inodes on the drive (count), or -1 if unimplemented
-
getTotalInodes
public long getTotalInodes()Description copied from interface:OSFileStoreTotal / maximum number of inodes of the filesystem. Not applicable on Windows.- Specified by:
getTotalInodesin interfaceOSFileStore- Returns:
- Total / maximum number of inodes of the filesystem (count), or -1 if unimplemented
-
updateFrom
Copies mutable attributes from another file store into this one.- Parameters:
fileStore- the source file store
-
updateSpaceAndInodes
protected void updateSpaceAndInodes(long freeSpace, long usableSpace, long totalSpace, long freeInodes, long totalInodes) Updates only the space and inode fields.- Parameters:
freeSpace- free space in bytesusableSpace- usable space in bytestotalSpace- total space in bytesfreeInodes- free inodestotalInodes- total inodes
-
updateSpace
protected void updateSpace(long freeSpace, long usableSpace, long totalSpace) Updates only the space fields (no inodes).- Parameters:
freeSpace- free space in bytesusableSpace- usable space in bytestotalSpace- total space in bytes
-
toString
-