Meminfo is an Java parser for "proc/meminfo" file.
The Meminfo library offers you the possibility to read the current data directly from the meminfo file.
MemoryInfoParserFactory memoryInfoParserFactory = MemoryInfoParserFactory.create();
try {
memoryInfoParserFactory.getFieldsFromFile().forEach(memoryInfoFileField -> {
System.out.println("KEY: " + memoryInfoFileField.key());
System.out.println("VALUE: " + memoryInfoFileField.value());
System.out.println("UNIT: " + memoryInfoFileField.memoryInfoUnit());
});
} catch (IOException failure) {
failure.printStackTrace(); // Your error handling
}
Maven
<repositories>
<repository>
<id>meminfo-repo</id>
<url>https://packagecloud.io/manuelkollus/opensource</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.github.manuelkollus</groupId>
<artifactId>meminfo-all</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>