本文整理汇总了Java中oshi.software.os.OSFileStore.getName方法的典型用法代码示例。如果您正苦于以下问题:Java OSFileStore.getName方法的具体用法?Java OSFileStore.getName怎么用?Java OSFileStore.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oshi.software.os.OSFileStore
的用法示例。
在下文中一共展示了OSFileStore.getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFileStores
import oshi.software.os.OSFileStore; //导入方法依赖的package包/类
@Test
public void getFileStores() {
OshiPlatformCache oshi = newOshiPlatformCache();
Map<String, OSFileStore> filestores = oshi.getFileStores();
Assert.assertNotNull(filestores);
int i = 0;
for (OSFileStore filestore : filestores.values()) {
String name = filestore.getName();
String description = filestore.getDescription();
long usableSpace = filestore.getUsableSpace();
long totalSpace = filestore.getTotalSpace();
Assert.assertNotNull(name);
Assert.assertNotNull(description);
Assert.assertTrue(usableSpace > -1L);
Assert.assertTrue(totalSpace > -1L);
print("===FILE STORE #%d ===", ++i);
print(" Name=[%s]", name);
print(" Description=[%s]", description);
print(" UsableSpace=[%s] (%d)", FormatUtil.formatBytes(usableSpace), usableSpace);
print(" TotalSpace=[%s] (%d)", FormatUtil.formatBytes(totalSpace), totalSpace);
print(" toString=[%s]", filestore.toString());
}
}
示例2: publishFilesystem
import oshi.software.os.OSFileStore; //导入方法依赖的package包/类
private void publishFilesystem(final Map<String, Object> sharedData) {
HardwareAbstractionLayer hal = m_systemInfo.getHardware();
for (OSFileStore fs : hal.getFileStores()) {
long free = fs.getUsableSpace();
long total = fs.getTotalSpace();
long used = total - free;
String instance = fs.getName() + " (" + fs.getDescription() + ")";
publishMetric(sharedData, FILESYSTEM_USED, used, instance);
publishMetric(sharedData, FILESYSTEM_FREE, free, instance);
publishMetric(sharedData, FILESYSTEM_TOTAL, total, instance);
}
}
示例3: storageInfo
import oshi.software.os.OSFileStore; //导入方法依赖的package包/类
StorageInfo storageInfo() {
List<DiskInfo> diskInfos = new ArrayList<>();
for (HWDiskStore diskStore : hal.getDiskStores()) {
OSFileStore associatedFileStore = findAssociatedFileStore(diskStore);
String name = associatedFileStore != null ? associatedFileStore.getName() : "N/A";
diskInfos.add(new DiskInfo(diskStore, diskHealth(name), diskSpeedForName(diskStore.getName()), associatedFileStore));
}
FileSystem fileSystem = operatingSystem.getFileSystem();
return new StorageInfo(diskInfos.toArray(/*type reference*/new DiskInfo[0]), fileSystem.getOpenFileDescriptors(), fileSystem.getMaxFileDescriptors());
}
示例4: getStorageName
import oshi.software.os.OSFileStore; //导入方法依赖的package包/类
@Override
public StringType getStorageName(int index) throws DeviceNotFoundException {
OSFileStore fileStore = (OSFileStore) getDevice(fileStores, index);
String name = fileStore.getName();
return new StringType(name);
}