IoT File Java 客户端
简介
IoT File Java 客户端允许您管理与 assets 相关的文件。有关该服务的更多信息,请参见 IoT File Service。
提示
在 IoT 环境中,assets 指 entity
,aspects 指 propertyset
。
文件操作
客户端名称:FileservicesClient
创建文件
用所提供的内容在指定实体和路径下创建文件。
FileservicesClient fileservicesClient = FileservicesClient.builder()
.mindsphereCredentials(credentials)
.restClientConfig(config)
.build();
FileWriterResponse fileWriterResponse;
try {
fileWriterResponse = fileservicesClient.createFile(file,entityId,filepath,description,type);
} catch (MindsphereException e) {
// Exception handling
}
更新文件
用所提供的内容在指定实体和路径下更新文件。
//Construct FileservicesClient object as shown above
FileWriterResponse fileWriterResponse;
try {
fileWriterResponse = fileservicesClient.updateFile(file, entityId, filepath, description, type, ifMatch);
} catch (MindsphereException e) {
// Exception handling
}
读取文件
读取指定实体和路径下的文件。使用 GET
方法进行 API 调用。
//Construct FileservicesClient object as shown above
FileReaderResponse fileReaderResponse;
try {
fileReaderResponse = fileservicesClient.readFile(entityId, filepath, ifNoneMatch)
} catch (MindsphereException e) {
// Exception handling
}
删除文件
删除指定实体和路径下的文件。
//Construct FileservicesClient object as shown above
boolean isFileDeleted;
try {
isFileDeleted = fileservicesClient.deleteFile(entityId, filepath)
} catch (MindsphereException e) {
// Exception handling
}
搜索文件
在指定实体和路径下搜索一个或多个文件。
//Construct FileservicesClient object as shown above
FileSearchResponse fileSearchResponse;
try {
fileSearchResponse = fileservicesClient.searchFiles(entityId, offset, limit, count, order, filter);
} catch (MindsphereException e) {
// Exception handling
}
还有问题?
除非另行声明,该网站内容遵循MindSphere开发许可协议.
Last update: June 26, 2019