OperatingSystemImpl

class OperatingSystemImpl(systemInfo: SystemInfo) : OperatingSystem

OperatingSystemImpl is the implementation of the OperatingSystem interface. It uses the oshi library to gather system operating information and map this information to the classes and methods provided by our API.

Parameters

systemInfo

The object containing general information about the operating system.

Constructors

Link copied to clipboard
constructor(systemInfo: SystemInfo)

Properties

Link copied to clipboard
open override val bitness: Int

bitness The bitness of the operating system (e.g., 32-bit, 64-bit).

Link copied to clipboard
open override val currentProcess: OSProcess

currentProcess The current running process.

Link copied to clipboard
open override val currentThread: OSThread

currentThread The current running thread.

Link copied to clipboard
open override val family: String

family The family of the operating system (e.g., "Windows", "Linux"). This property represents the type of operating system.

Link copied to clipboard
open override val fileSystem: FileSystem

fileSystem The file system information, including the list of file stores and other statistics.

Link copied to clipboard
private val fileSystemInfo: OperatingSystem

A lazy-initialized property that holds the information about the operating system. This property is retrieved from the systemInfo object and represents the operating system details that include file system information, version, network statistics, and more.

Link copied to clipboard

internetProtocolStats The statistics related to network protocols (TCP/UDP).

Link copied to clipboard
open override val isElevated: Boolean

isElevated Indicates if the operating system is running in elevated (privileged) mode.

Link copied to clipboard
open override val manufacturer: String

manufacturer The manufacturer of the operating system (e.g., "Microsoft", "Apple").

Link copied to clipboard
open override val networkParams: NetworkParams

networkParams The network parameters, including hostname, DNS, gateway.

Link copied to clipboard
open override val processCount: Int

processCount The number of active processes running on the system.

Link copied to clipboard
open override val processId: Int

processId The ID of the current process.

Link copied to clipboard
open override val services: List<OSService>

services The list of active services on the operating system.

Link copied to clipboard
open override val sessions: List<OSSession>

sessions The list of user sessions active on the operating system.

Link copied to clipboard
open override val systemBootTime: Long

systemBootTime The system boot time in milliseconds (UNIX timestamp).

Link copied to clipboard
open override val systemUptime: Long

systemUptime The system uptime in milliseconds.

Link copied to clipboard
open override val threadCount: Int

threadCount The number of threads running on the system.

Link copied to clipboard
open override val threadId: Int

threadId The ID of the current thread.

Link copied to clipboard
open override val versionInfo: OSVersionInfo

versionInfo The version information of the operating system.

Functions

Link copied to clipboard
open override fun getOSDesktopWindows(visibleOnly: Boolean): List<OSDesktopWindow>

Retrieves the visible desktop windows of the operating system.

Link copied to clipboard
open override fun getProcess(pid: Int): OSProcess

Retrieves a single process by its PID.

Link copied to clipboard
open override fun getProcesses(): List<OSProcess>

Retrieves the list of all active processes on the system.

open override fun getProcesses(pids: Collection<Int>): List<OSProcess>

Retrieves the list of processes specified by their PIDs.

Link copied to clipboard
private fun initOSProcess(source: OSProcess): OSProcess

Initializes an OSProcess object from an OSHI OSProcess object.

Link copied to clipboard
private fun initOSThread(source: OSThread): OSThread

Initializes an OSThread object from an OSHI OSThread object.

Link copied to clipboard
private fun loadOSDesktopWindows(sourceList: List<OSDesktopWindow>): List<OSDesktopWindow>

Loads a list of OSDesktopWindow objects from the provided list of oshi.software.os.OSDesktopWindow.

Link copied to clipboard
private fun loadOSProcesses(sourceList: List<OSProcess>): List<OSProcess>

Loads a list of processes from a list of OSHI OSProcess objects.

Link copied to clipboard
private fun loadOSServices(sourceList: List<OSService>): List<OSService>

Loads a list of services from a list of OSHI OSService objects.

Link copied to clipboard
private fun loadOSSessions(sourceList: List<OSSession>): List<OSSession>

Loads a list of sessions from a list of OSHI OSSession objects.

Link copied to clipboard
private fun loadOSThreads(sourceList: List<OSThread>): List<OSThread>

Loads a list of threads from a list of OSHI OSThread objects.