oshi.software.common.AbstractFileSystem Maven / Gradle / Ivy
/**
* Oshi (https://github.com/dblock/oshi)
*
* Copyright (c) 2010 - 2016 The Oshi Project Team
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Maintainers:
* dblock[at]dblock[dot]org
* widdis[at]gmail[dot]com
* enrico.bianchi[at]gmail[dot]com
*
* Contributors:
* https://github.com/dblock/oshi/graphs/contributors
*/
package oshi.software.common;
import javax.json.Json;
import javax.json.JsonBuilderFactory;
import javax.json.JsonObject;
import oshi.json.NullAwareJsonObjectBuilder;
import oshi.software.os.FileSystem;
import oshi.software.os.OSFileStore;
/**
* The File System is a storage pool, device, partition, volume, concrete file
* system or other implementation specific means of file storage. See subclasses
* for definitions as they apply to specific platforms.
*
* @author widdis[at]gmail[dot]com
*/
public abstract class AbstractFileSystem implements FileSystem {
private static final long serialVersionUID = 1L;
private JsonBuilderFactory jsonFactory = Json.createBuilderFactory(null);
/**
* {@inheritDoc}
*/
@Override
public JsonObject toJSON() {
return NullAwareJsonObjectBuilder.wrap(jsonFactory.createObjectBuilder())
.add("openFileDescriptors", getOpenFileDescriptors()).add("maxFileDescriptors", getMaxFileDescriptors())
.build();
}
/**
* {@inheritDoc}
*/
@Override
public abstract OSFileStore[] getFileStores();
}