Class SystemInfo


  • public class SystemInfo
    extends java.lang.Object
    The class contains utility functions to get information about the current system that is not available via the Java API.
    • Constructor Summary

      Constructors 
      Constructor Description
      SystemInfo()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long getFreeDiskSpace​(java.io.File file)
      Retrieves the free disk space for the disk containing the given file on Windows, macOS and Linux.
      static long getPhysicalMemory()
      Retrieves the physical memory on Windows, macOS and Linux.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SystemInfo

        public SystemInfo()
    • Method Detail

      • getFreeDiskSpace

        public static long getFreeDiskSpace​(java.io.File file)
        Retrieves the free disk space for the disk containing the given file on Windows, macOS and Linux.
        Parameters:
        file - the file or directory to check the disk space for
        Returns:
        the free disk space in bytes. -1 if the information is not available.
      • getPhysicalMemory

        public static long getPhysicalMemory()
        Retrieves the physical memory on Windows, macOS and Linux.
        Returns:
        the physical memory in bytes. 0 if the information is not available.