Class TruffleFile.FileStoreInfo

java.lang.Object
com.oracle.truffle.api.TruffleFile.FileStoreInfo
Enclosing class:
TruffleFile

public final class TruffleFile.FileStoreInfo extends Object
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 Details

    • getTotalSpace

      public long getTotalSpace() throws IOException
      Returns the size, in bytes, of the file store. If the file store's size exceeds Long.MAX_VALUE, Long.MAX_VALUE is returned.
      Returns:
      the size of the file store in bytes
      Throws:
      UnsupportedOperationException - if the file system does not support retrieving file store information
      IOException - if an I/O error occurs while accessing the file store
      SecurityException - if the FileSystem implementation denied the operation
      Since:
      25.0.0
    • getUnallocatedSpace

      public long getUnallocatedSpace() throws IOException
      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 exceeds Long.MAX_VALUE, Long.MAX_VALUE is 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 information
      IOException - if an I/O error occurs while accessing the file store
      SecurityException - if the FileSystem implementation denied the operation
      Since:
      25.0.0
    • getUsableSpace

      public long getUsableSpace() throws IOException
      Returns the number of bytes available to this Java virtual machine on the file store. Unlike getUnallocatedSpace(), 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 exceeds Long.MAX_VALUE, Long.MAX_VALUE is 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 information
      IOException - if an I/O error occurs while accessing the file store
      SecurityException - if the FileSystem implementation denied the operation
      Since:
      25.0.0
    • getBlockSize

      public long getBlockSize() throws IOException
      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 information
      IOException - if an I/O error occurs while accessing the file store
      SecurityException - if the FileSystem implementation denied the operation
      Since:
      25.0.0
    • isReadOnly

      public boolean isReadOnly() throws IOException
      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 FileSystem implementation, operating system level policies, user quotas, or file system permissions.

      Throws:
      UnsupportedOperationException - if the file system does not support retrieving file store information
      IOException - if an I/O error occurs while accessing the file store
      SecurityException - if the FileSystem implementation denied the operation
      Since:
      25.0.0