Class TruffleFile.FileStoreInfo
java.lang.Object
com.oracle.truffle.api.TruffleFile.FileStoreInfo
- Enclosing class:
TruffleFile
Provides information about the file store. This class offers access to storage-related
metrics, such as the total size of the file store, unallocated space, and the usable space
available to the current Java virtual machine.
- Since:
- 25.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlongReturns the number of bytes per block in the file store.longReturns the size, in bytes, of the file store.longReturns the number of unallocated bytes in the file store.longReturns the number of bytes available to this Java virtual machine on the file store.booleanDetermines whether the file store is read-only.
-
Method Details
-
getTotalSpace
Returns the size, in bytes, of the file store. If the file store's size exceedsLong.MAX_VALUE,Long.MAX_VALUEis returned.- Returns:
- the size of the file store in bytes
- Throws:
UnsupportedOperationException- if the file system does not support retrieving file store informationIOException- if an I/O error occurs while accessing the file storeSecurityException- if theFileSystemimplementation denied the operation- Since:
- 25.0.0
-
getUnallocatedSpace
Returns the number of unallocated bytes in the file store. The returned value represents the raw free space on the storage device, regardless of access permissions or user quotas. If the number of unallocated bytes exceedsLong.MAX_VALUE,Long.MAX_VALUEis returned. Note that the value may be imprecise, as it can change at any time due to external I/O operations, including those performed outside this virtual machine.- Returns:
- the number of unallocated bytes
- Throws:
UnsupportedOperationException- if the file system does not support retrieving file store informationIOException- if an I/O error occurs while accessing the file storeSecurityException- if theFileSystemimplementation denied the operation- Since:
- 25.0.0
-
getUsableSpace
Returns the number of bytes available to this Java virtual machine on the file store. UnlikegetUnallocatedSpace(), this method accounts for operating system-level restrictions, user quotas, and file system permissions, and therefore may return a smaller value. If the available space exceedsLong.MAX_VALUE,Long.MAX_VALUEis returned. Note that the returned value may be imprecise, as it can change at any time due to external I/O activity, including operations performed outside this virtual machine.- Returns:
- the number of usable bytes available to this Java virtual machine
- Throws:
UnsupportedOperationException- if the file system does not support retrieving file store informationIOException- if an I/O error occurs while accessing the file storeSecurityException- if theFileSystemimplementation denied the operation- Since:
- 25.0.0
-
getBlockSize
Returns the number of bytes per block in the file store.- Returns:
- the block size
- Throws:
UnsupportedOperationException- if the file system does not support retrieving file store informationIOException- if an I/O error occurs while accessing the file storeSecurityException- if theFileSystemimplementation denied the operation- Since:
- 25.0.0
-
isReadOnly
Determines whether the file store is read-only.Note that even if the file store is not read-only, individual write operations may still be denied due to restrictions imposed by the
FileSystemimplementation, operating system level policies, user quotas, or file system permissions.- Throws:
UnsupportedOperationException- if the file system does not support retrieving file store informationIOException- if an I/O error occurs while accessing the file storeSecurityException- if theFileSystemimplementation denied the operation- Since:
- 25.0.0
-