Class AbstractGlobalMemory

java.lang.Object
oshi.hardware.common.AbstractGlobalMemory
All Implemented Interfaces:
GlobalMemory
Direct Known Subclasses:
FreeBsdGlobalMemory, LinuxGlobalMemory, MacGlobalMemory, SolarisGlobalMemory, WindowsGlobalMemory

public abstract class AbstractGlobalMemory
extends java.lang.Object
implements GlobalMemory
Memory info.
  • Constructor Details

  • Method Details

    • getPhysicalMemory

      public PhysicalMemory[] getPhysicalMemory()
      Description copied from interface: GlobalMemory
      Physical memory, such as banks of memory.

      On Linux, requires elevated permissions. On FreeBSD and Solaris, requires installation of dmidecode.

      Specified by:
      getPhysicalMemory in interface GlobalMemory
      Returns:
      A list of PhysicalMemory objects.
    • parsePhysicalMemorySize

      protected long parsePhysicalMemorySize​(java.lang.String size)
      Parses a string such as "4096 MB" to its long. Used to parse macOS and *nix memory chip sizes. Although the units given are decimal they must parse to binary units.
      Parameters:
      size - A string of memory sizes like "4096 MB"
      Returns:
      the size parsed to a long
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object