Record Class OsInfo
java.lang.Object
java.lang.Record
cloud.opencode.base.core.system.OsInfo
- Record Components:
name- operating system name - 操作系统名称version- operating system version - 操作系统版本arch- processor architecture - 处理器架构hostname- machine hostname - 主机名availableProcessors- number of available processors - 可用处理器数量physicalMemoryTotal- total physical memory in bytes - 总物理内存(字节)swapTotal- total swap space in bytes - 总交换空间(字节)
public record OsInfo(String name, String version, String arch, String hostname, int availableProcessors, long physicalMemoryTotal, long swapTotal)
extends Record
Immutable snapshot of operating system information.
操作系统信息的不可变快照。
Captures OS name, version, architecture, hostname, and basic hardware metrics at the time of creation.
捕获创建时的操作系统名称、版本、架构、主机名和基本硬件指标。
Usage Examples | 使用示例:
OsInfo os = SystemInfo.os();
System.out.println("OS: " + os.name() + " " + os.version());
System.out.println("Host: " + os.hostname());
- Since:
- JDK 25, opencode-base-core V1.0.3
- Author:
- Leon Soo
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarch()Returns the value of thearchrecord component.intReturns the value of theavailableProcessorsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.hostname()Returns the value of thehostnamerecord component.name()Returns the value of thenamerecord component.longReturns the value of thephysicalMemoryTotalrecord component.longReturns the value of theswapTotalrecord component.final StringtoString()Returns a string representation of this record class.version()Returns the value of theversionrecord component.
-
Constructor Details
-
OsInfo
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
name
-
version
-
arch
-
hostname
-
availableProcessors
public int availableProcessors()Returns the value of theavailableProcessorsrecord component.- Returns:
- the value of the
availableProcessorsrecord component
-
physicalMemoryTotal
public long physicalMemoryTotal()Returns the value of thephysicalMemoryTotalrecord component.- Returns:
- the value of the
physicalMemoryTotalrecord component
-
swapTotal
-